Prof. Ossama's budget

No attempts yetTime limit1sMemory limit256 MB

Problem

Prof. Ossama Ismail directs the ACPC regional contest. One year he decided to plan the budget like this. Every team receives the same amount AA, and AA is taken as large as possible, so the fund is split into equal shares until less than one team's share is left. Whatever remains after that goes to the other needs of the contest.

Fund raising went well that year, so NN can have a great many digits. Given the fund NN and the number of teams XX, find how much money is left for the other needs.

Input

The first line contains an integer TT, the number of test cases (1T1001 \le T \le 100).

Each of the next TT lines contains two integers NN and XX separated by a space. NN is the available fund, a positive integer with no leading zeros and at most one million digits. XX is the number of teams (1X1071 \le X \le 10^7).

Output

For each test case print one line in the form Case n: R, where nn is the test case number starting from 11 and RR is the money left for the other needs of the contest.