Problem:
National Budget

A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647.

Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers.

If given integers or the sum have more than 80 digits, print "overflow".

Input

Input consists of several datasets. In the first line, the number of datasets N (1 ≤ N ≤ 50) is given. Each dataset consists of 2 lines:

The first integer
The second integer

The integer has at most 100 digits.

Output

For each dataset, print the sum of given integers in a line.

Sample Input

6
1000
800
9999999999999999999999999999999999999999
1
99999999999999999999999999999999999999999999999999999999999999999999999999999999
1
99999999999999999999999999999999999999999999999999999999999999999999999999999999
0
100000000000000000000000000000000000000000000000000000000000000000000000000000000
1
100000000000000000000000000000000000000000000000000000000000000000000000000000000
100000000000000000000000000000000000000000000000000000000000000000000000000000000

Output for the Sample Input

1800
10000000000000000000000000000000000000000
overflow
99999999999999999999999999999999999999999999999999999999999999999999999999999999
overflow
overflow

Solution in JAVA (judge verdict: Accepted)

import java.util.Scanner;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.lang.Math;

class Main{

    private final static int DATA_TYPE_INTEGER = 1;
    private final static double DATA_TYPE_DOUBLE = 2.0;
    
    public static void main(String[] args){
        InputStreamReader inputStreamReader = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(inputStreamReader);
        

        // ----- 共通変数 ----- //
        int[] num;
        int DataType = DATA_TYPE_INTEGER;
        //double[] num;
        //double DataType = DATA_TYPE_DOUBLE;
        boolean flag = false; // 提出時はfalse

        // ----- 課題別変数 ----- //
        boolean first = true;
        int[] x = null;
        int[] y = null;
        int[] z = null;
        
        try {
            while(flag || reader.ready()){
                // データの取得
                num = changeNum(reader.readLine(), (long)DataType);


                // ----- データ処理 ----- //
                
                // 初回のみ別処理
                if(first) {
                    first = false;
                    continue;
                } 

                if(x == null) {
                    x = num.clone();
                } else {
                    y = num.clone();
                    z = sum(x, y);
                    
                    if (z.length <= 80) {
                        for (int i = z.length - 1; i >= 0; i--) {
                            System.out.print(z[i]);
                        }
                        System.out.println("");
                    }
                    else{
                        System.out.println("overflow");
                    }

                    x = null;
                    y = null;
                }
                
            }
            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    // ----- 自作関数（課題別） ----- //
    private static int[] changeNum(String str, long DataType){
        //private static double[] getNum(String str){
        int[] num = new int[str.length()];
        int begin, end;
        for (int i = 0; i < str.length(); i++){
            begin = str.length() - i - 1;
            end = begin + 1;
            num[i] = Integer.parseInt(str.substring(begin, end));
        }    
        return num;
    }

    private static int[] sum(int[] x, int[] y) {
        int[] z = new int[Max(x.length, y.length)];
        boolean move_up = false;
        int i = 0;
        int xi, yi;

        while (i < x.length || i < y.length){
            xi = (i < x.length) ? x[i] : 0;
            yi = (i < y.length) ? y[i] : 0;
            
            z[i] = move_up ? (xi + yi + 1) : (xi + yi);
            move_up = z[i] >= 10 ? true : false;
            z[i] %= 10;

            i++;
        }

        if (move_up) {
            // 最上位に繰り上げがあったとき
            int[] z2 = new int[z.length + 1];
            for (i = 0; i < z.length; i++) {
                z2[i] = z[i];
            }
            z2[i] = 1;

            return z2;
        }
        else {
            return z;
        }
    }

    // ----- 自作関数（共通） ----- //

    private static int[] changeNum(String str, int DataType){
    //private static double[] getNum(String str){
        String[] data = str.split(" "); 
        int[] num = new int[data.length];

        for (int i = 0; i < data.length; i++){
            num[i] = Integer.parseInt(data[i]);
        }

        return num;
    }

    private static double[] changeNum(String str, double DataType){
        String[] data = str.split(" "); 
        double[] num = new double[data.length];

        for (int i = 0; i < data.length; i++){
            num[i] = Double.parseDouble(data[i]);
        }
            
        return num;
    }

    private static int[] extractList(int[] originalList, int begin, int end){
        int[] list = new int[end - begin];
        int p = 0;

        for (int i = begin; i <= end; i++) {
            list[p++] = originalList[i];
        }

        return list;
    }

    private static double[] extractList(double[] originalList, int begin, int end){
        double[] list = new double[end - begin];
        int p = 0;

        for (int i = begin; i < end; i++) {
            list[p++] = originalList[i];
        }

        return list;
    }

    private static void swap(int[] box, int a, int b) {
        int temp = box[a];
        box[a] = box[b];
        box[b] = temp;
    }

    private static void swap(double[] box, int a, int b) {
        double temp = box[a];
        box[a] = box[b];
        box[b] = temp;
    }

    private static int Max(int a, int b) {
        return a > b ? a : b;
    }
 }