Gorwin is very interested in equations. Nowadays she gets an equation like this 0≤xi≤nfor1≤i≤nxi≤xi+1≤xi+1for1≤i≤n−1\begin{array}{l} 0 \le {x_i} \le n{\kern 1pt} {\kern 1pt} {\kern 1pt} for{\kern 1pt} {\kern 1pt} {\kern 1pt} 1 \le i \le n\ {x_i} \le {x_{i + 1}}{\kern 1pt} \le {x_i} + 1{\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} for{\kern 1pt} {\kern 1pt} {\kern 1pt} 1 \le i \le n - 1 \end{array}0≤xi≤nfor1≤i≤nxi≤xi+1≤xi+1for1≤i≤n−1 For a certain nnn, Gorwin wants to know how many combinations of xixixi satisfies above condition. For the answer may be very large, you are expected output the result after it modular mmm.
Multi test cases. The first line of the file is an integer TTT indicates the number of test cases. In the next TTT lines, every line contain two integer n,mn, mn,m.
[Technical Specification] 1≤T<201 \leq T < 201≤T<20 1≤n≤500001 \leq n \leq 500001≤n≤50000 1≤m≤10000000001 \leq m \leq 10000000001≤m≤1000000000
For each case output should occupies one line, the output format is Case #id: ans, here id is the data number starting from 1, ans is the result you are expected to output. See the samples for more details.
2 3 100 5 100
Case #1: 2 Case #2: 3