digit-lover-2-1

Jimmy is very fond of adding two values but he do that in a different way ,  whenever he gets two values he adds both the first digit and add both the second digit and both the third digit and so on until he gets a new value.

Input

First line of input contains the number of test cases(T). Next each of T lines contains two positive integer value.

Output

You have to print the single digit answer for each test case.

Constraints :
1<T ≤ 10
1<values ≤ 10^5

SAMPLE INPUT
2
456 321
8864 9945

SAMPLE OUTPUT
777
1717109

Explanation

Case 1 :

4  5  6 
|  |  | =   777
3  2  1
---------
7  7  7

Case 2 :

8     8     6    4    
|     |     |    |     =  1717109
9     9     4    5
-------------------
17  17  10   9

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions: