CS 2440 - Computer Science II

Adding Reversed Numbers

Assigned: May 25, 2004
Due date: Midnight, Saturday May 29, 2004

A reversed number is a number written in arabic numerals but the order of digits is reversed. The first digit becomes the last and vice versa. For example, 1245 becomes 5421 when reversed. Note that all leading zeros are omitted. So, if a number ends in one or more zeros, the zeros are lost by reversing, e.g., 1200 gives 21. Also note that the reversed number never has any trailing zeros.

Your task is to add two reversed numbers and output their reversed sum. Of course, the result is not necessarily unique because any particular number is a reversed form of several numbers, e.g., 21 could be 12, 120, or 1200 before reversing. Thus, we must assume that no zeros were lost by reversing, e.g., assume the original number was 12 in the given example.


The input consists of N cases. The first line of input contains only the positive integer N. Each case then follows on separate lines with each line containing two positive integers separated by space. The two numbers on each line are to be added.


For each case, print exactly one line of output containing only one integer, the reversed sum of the two reversed numbers input. Omit any leading zeros in the output.
Sample Input
24 1
4358 754
305 794
Sample Output