5 2
For this input, the required output is 10.
10
10 0
For this input, the required output is 1.
1
10 10
Given non-negative integers nnn and rrr, compute the binomial coefficient C(n,r)C(n, r)C(n,r) modulo 109+710^9 + 7109+7.
The binomial coefficient is defined as: C(n,r)=n!r!⋅(n−r)!C(n, r) = \frac{n!}{r! \cdot (n-r)!}C(n,r)=r!⋅(n−r)!n!
nrn \quad rnr
C(n,r)mod (109+7)C(n, r) \mod (10^9 + 7)C(n,r)mod(109+7)