I'm stuck in a problem in which I need to calculate something like:
((500!)/(20!x20!x20!x20!...)) mod 1000000007
I understand how to calculate 500!%1000000007 but I am not sure on how to distribute that operator in division.
I am currently trying to write a code which cancels the denominators by its numerator by its factors. But I am not sure if it is a good approach to this.
I just need a mathematical way of solving these kind of problems(mod1000000007) as they are regularly encountered in programming competitions and would help me to prepare for Google Code Jam.