Mathematics knowledge is vital in Artificial Intelligence Area, Minieye wants to employ those who are good at Mathematics such as ACMers. Here is a problem related to mathematics Given 2n digits from 1 to 9, your task is to compose two integers A, B of length n, to minimize the value of |A+B-10n|. In this situation, leading zeros is legal.
There are several cases, first is the number of cases T. (T = 100000).
For each case, there is only one line contains a string of 2n digits.（n<=18）
For each case, output the minimum value in a line.
3 9820 192747 000001
0 7 900