I am using C++ programming language. We are given 3 integers $x,y,z$ and I have to calculate :-
$(x +y +z)!/(x!*y!*z!) $ modulo $p$
where , $p=10^9+7$
Also , $0<=x,y,z<=10^5$
I tried many approaches but none of them worked. Fermat's theorem also does not work here :(
In C++,the maximum value an integer can have is 10^18.
p=10^9+7;x=10^5-1;y=10^5-11;z=10^5-21;, check in pari/gp calculatorMod((x+y+z)!/(x!*y!*z!),p), output isMod(912505566, 1000000007). – Dmitry Ezhov Jun 26 '19 at 17:46