Problem: Given a natural number . You can perform the following operation:
- choose a positive integer and round to the -th digit
Note that the positions are numbered from right to left, starting from zero. If the number has digits, it is considered that the digit at the -th position is equal to .
The rounding is done as follows:
- if the digit at the -th position is greater than or equal to , then the digit at the -th position is increased by , otherwise the digit at the -th position remains unchanged (mathematical rounding is used).
- if before the operations the digit at the -th position was , and it should be increased by , then we search for the least position (), where the digit at the -th position is less than and add to the digit at the -th position. Then we assign .
- after that, all digits which positions are less than are replaced with zeros.
Your task is to make as large as possible, if you can perform the operation as many times as you want.
For example, if is equal to , then if you choose consecutively:
- , then after the operation will become
- , then after the operation will become
- , then after the operation will become
- , then after the operation will become
Input Format: The first line contains a single integer () — the number of test cases.
Each test case consists of positive integer with a length of up to . It is guaranteed that there are no leading zeros in the integer.
It is guaranteed that the sum of the lengths of all integers over all test cases does not exceed .
Output Format: For each set of input data, output the maximum possible value of after the operations. The number should not have leading zeros in its representation.
Note: In the first sample, it is better not to perform any operations.
In the second sample, you can perform one operation and obtain .
In the third sample, you can choose or . In both cases the answer will be .