Challenge Nine

아직 제출이 없습니다메모리 제한1024 MB

문제

Ada gives John a positive integer NN. She challenges him to construct a new number (without leading zeros), that is a multiple of 99, by inserting exactly one digit (0 …… 9) anywhere in the given number NN. It is guaranteed that NN does not have any leading zeros.

As John prefers smaller numbers, he wants to construct the smallest such number possible. Can you help John?

입력

The first line of the input gives the number of test cases, TTTT test cases follow.

Each test case has a single line containing a positive integer NN: the number Ada gives John.

출력

For each test case, output one line containing Case #x: y, where xx is the test case number (starting from 1) and yy is the new number constructed by John. As mentioned earlier, yy cannot have leading zeros.

제한

  • 1T1001≤T≤100.

힌트

In Sample Case #1, there are only two numbers that can be constructed satisfying the divisibility constraint: 4545 and 5454. John chooses the smaller number.

In Sample Case #2, 333333 is the only number possible.

In Sample Case #3, there are four possible options - 212121212121122121122121121221121221 and 121212121212 - out of which the smallest number is 121212121212.