#Lutece1177. pow(a, C(n,m) ) % k
pow(a, C(n,m) ) % k
Migrated from Lutece 1177 pow(a, C(n,m) ) % k
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
One day, Peter was given an easy math problem.
Given four integers , , , and two formulas , , you are supposed to calculate the result of .
However, Peter found that the ranges of , , , are so large that Peter could not solve it. Could you help him?
Input
The first line contains an integer representing the number of test cases.
Each of the following lines contains four integers , , , . The ranges of them are following.
, , ,
Output
Output T lines as the sample output. Output each line as "Case #k: ans". means the number of test case, means the result of those two formulas when given those four integers.
Samples
4
5 0 0 4
100 10 5 3
233035515918638532 700708637 28 32886
999999999992226432 251468460246892460 313092 280
Case #1: 1
Case #2: 1
Case #3: 26244
Case #4: 64
Resources
peterpan