Prof. Ossama's budget
InterviewTime limit1sMemory limit256 MB
Each test case asks for the remainder when a fund N with up to one million digits is divided by X.
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 , and 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 can have a great many digits. Given the fund and the number of teams , find how much money is left for the other needs.
Input
The first line contains an integer , the number of test cases ().
Each of the next lines contains two integers and separated by a space. is the available fund, a positive integer with no leading zeros and at most one million digits. is the number of teams ().
Output
For each test case print one line in the form Case n: R, where is the test case number starting from and is the money left for the other needs of the contest.