In the Counting Poetry Slam, a performer takes the microphone, chooses a number , and counts aloud from to . That is, she starts by saying , and then repeatedly says the number that is greater than the previous number she said, stopping after she has said .
It's your turn to perform, but you find this process tedious, and you want to add a twist to speed it up: sometimes, instead of adding to the previous number, you might reverse the digits of the number (removing any leading zeroes that this creates). For example, after saying "16", you could next say either "17" or "61"; after saying "2300", you could next say either "2301" or "32". You may reverse as many times as you want (or not at all) within a performance.
The first number you say must be ; what is the fewest number of numbers you will need to say in order to reach the number ? and count toward this total. If you say the same number multiple times, each of those times counts separately.
输入格式
The first line of the input gives the number of test cases, . lines follow. Each has one integer , the number you must reach.
输出格式
For each test case, output one line containing "Case #: ", where is the test case number (starting from ) and is the minimum number of numbers you need to say.
样例
样例输入 1
3
1
19
23
样例输出 1
Case #1: 1
Case #2: 19
Case #3: 15
数据范围与提示
Sample Explanation
In Case #2, flipping does not help and the optimal strategy is to just count up to .
In Case #3, the optimal strategy is to count up to , flip to , and then continue counting up to . That is, the numbers you will say are .