P13750 [CodeChef] ren2013a
NOI
题目描述

NOTE :This problem is just a test problem. The submissions to this problem will not be counted in the final ranklist for prize distribution. We apologize for the inconvenience caused.  

Problem description
Given two integers A and B that are not necessarily in base-10, find the smallest possible A + B in base-10.

For example,
A = 213, possibly base-4 (39 in base-10)
B = 4721, possibly base-8 (2513 in base-10)
A + B = 39 + 2513 = 2552 

Input

First line of the input contains a positive integer T (1 <= T <= 100), the number of cases. Each case contains
two positive integers A and B. A and B will contain at most 5 digits, each digit will be between 0 and 9,
inclusive, and no leading zeroes.

Output

For each case, output an integer in base-10 denoting the smallest possible A + B.

Example
Input:
3
213 4721
1001 90
638 241

Output:
2552
99
592

输入格式

见题面

输出格式

见题面

样例输入
3 213 4721 1001 90 638 241
样例输出
2552 99 592