#nt1001. 组合数取模5

组合数取模5

Binomial Coefficients Modulo p

Problem Description

Given a prime pp and an integer nn, for each r=0,1,…,p−1r = 0, 1, \dots, p - 1, count how many pairs (i,j)(i, j) with 0≤j≤i≤n0 \le j \le i \le n satisfy (ij)≡r(modp)\binom{i}{j} \equiv r \pmod p.

Input Format

The first line contains two integers n,pn, p.

Output Format

Output one line of pp numbers, the answers for r=0,1,…,p−1r = 0, 1, \dots, p - 1.

Sample Input

114 7

Sample Output

4012 900 273 450 315 276 444

Constraints

For all test cases, 2≤p≤1002 \le p \le 100, 1≤n≤1091 \le n \le 10^9, and pp is prime.