#P3807. Computing Binomial Coefficient Modulo Prime

    ID: 17057 Type: Default 1000ms 256MiB

Computing Binomial Coefficient Modulo Prime

Computing Binomial Coefficient Modulo Prime

Given three integers n, m, and p, where p is a prime, compute the value of \(C_{n+m}^{n}\) modulo \(p\). In mathematical terms, you need to calculate:

\[ \binom{n+m}{n} \bmod p \]

Note: \(C\) denotes the binomial coefficient.

inputFormat

The input consists of three integers n, m, and p separated by spaces.

outputFormat

Output a single integer representing \(\binom{n+m}{n} \bmod p\).

sample

2 3 7
3