P28823 [洛谷] Extended Lucas Theorem/exLucas
提高+
题目描述

Problem Background

This is a template problem.

Problem Description

Calculate

$${\mathrm{C}}_n^m \bmod{p}$$

where $\mathrm{C}$ represents the combination number.

Input Format

A single line containing three integers $n, m, p$, as described in the problem.

Output Format

A single line containing one integer, representing the answer.

Sample Input and Output

Sample Input #1

5 3 3

Sample Output #1

1

Sample Input #2

666 233 123456

Sample Output #2

61728

Notes

For $100\%$ of the data, $1 \le m \le n \le 10^{18}$, $2 \le p \le 10^6$, and it is not guaranteed that $p$ is a prime number.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5 3 3
样例输出
1