**62 人解决**，83 人已尝试。

**107 份提交通过**，共有 384 份提交。

**4.0** EMB 奖励。

**单点时限: **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 奖励。

题目标签