AdvancedRating 1900
Big Binomial Modulo a Prime
Print C(n, k) modulo the prime p. Use Lucas's theorem.
Input
Three integers n, k (0 ≤ k, n ≤ 10¹⁸) and a prime p (≤ 1000).
Output
One integer.
Sample 1
Input
10 3 7
Output
1
Sample 2
Input
5 2 3
Output
1
Output appears here