An N-digit runaround number is defined as follows:
For example, we verify that 81362 is a runaround number as follows:
8 1 3 6 2
-
8 1 3 6 2
- -
8 1 3 6 2
- - -
8 1 3 6 2
- - - -
8 1 3 6 2
- - - - -
8 1 3 6 2
= - - - -
You are given one or more lines, each containing a single integer R with between 2 and 7 digits. For each R, find the smallest runaround number that is greater than or equal to R; such a number always exists for every input value. The input ends with a line that contains only the digit 0 in the first column; do not process that line.
For each input value, in order, print one line in the form Case k: X, where k is the 1-based index of the query and X is the smallest runaround number greater than or equal to that query's R.