3455. Huge Numbers (Small)

单点时限: 2.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.

  • Limits: .
  • Small dataset: .
  • Large dataset: .

输出格式

For each test case, output one line containing Case #x: y, where is the test case number (starting from 1) and is the answer.

样例

Input
2
2 1 2
3 3 2
Output
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.

62 人解决,83 人已尝试。

107 份提交通过,共有 384 份提交。

4.0 EMB 奖励。

创建: 2 年,1 月前.

修改: 2 年,1 月前.

最后提交: 2 月,2 周前.

来源: Kickstart 2017 Round G

题目标签