Prof. Ossama Ismail directs the ACPC regional contest. One year he decided to plan the budget like this. Every team receives the same amount A, and A 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 N can have a great many digits. Given the fund N and the number of teams X, find how much money is left for the other needs.
The first line contains an integer T, the number of test cases (1≤T≤100).
Each of the next T lines contains two integers N and X separated by a space. N is the available fund, a positive integer with no leading zeros and at most one million digits. X is the number of teams (1≤X≤107).
For each test case print one line in the form Case n: R, where n is the test case number starting from 1 and R is the money left for the other needs of the contest.