(This problem is really old&easy and any acmer who is good at math may solve it in second) As we know, math is both intangible and specific. Today you are going to solve the following math problem: Given one non-negative integer b, one positive number P and one positive integer M, how many n could you find to satisfy the following 2 rules?
Here n! means n factorial , 0!=1,1!=1,2!=2,3!=6…,n!=(n-1)!*n
输入解释
In the first line of the input , we have one integer T indicating the number of test cases. (1 <= T <= 20) Then T cases follows. For every case, only 3 integers (b, P and M) in a single line. ( 0<=b<P, 1<=P<=10^5, 1 <= M <=2^64 – 1 )
输出解释
For each test case, first you should print "Case #x: " in a line, where x stands for the case number started with 1. Then one integer indicates the number of "n" that you can find.