The place I'm stuck is how to deal with the ever growing numbers. These numbers get so big that they quickly overflow and not even big.Int is a solution. Have to find a way to reduce the numbers while we're building them up.
It's clearly a trick around mod. Basically what can we reduce that will not effect the next calculation. Need to think on that a bit.