56 人解决，64 人已尝试。
79 份提交通过，共有 281 份提交。
3.7 EMB 奖励。
单点时限: 4.0 sec
内存限制: 256 MB
Professor Shekhu has another problem for Akki today. He has given him three positive integers , and and wants him to calculate the remainder when is divided by . As usual, denotes the product of the first positive integers.
The first line of the input gives the number of test cases, . lines follow. Each line contains three integers , and , as described above.
For each test case, output one line containing
Case #x: y, where is the test case number (starting from 1) and is the answer.
2 2 1 2 3 3 2
Case #1: 0 Case #2: 1
In Sample Case #1, the answer is the remainder when is divided by 2, which is 0.
In Sample Case #2, the answer is the remainder when is divided by 2, which is 1.