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 Ruby (judge verdict: Accepted)

# AOJ 0015 National Budget

class Bigint
  MAX_DIGIT = 80

  attr_reader :digit_num

  def initialize(s = "0")
    raise ArgumentError, "Non-numeric character exists" if /[^0-9]/ =~ s

    @digit = Array.new(MAX_DIGIT, 0)

    s = s.sub(/^0+/, "").reverse

    if s.empty?
      # 0 と等しい場合
      @digit_num = 1
    else
      # 0 より大きい場合
      @digit_num = s.length
      raise OverflowError, "Given integer is too big" if @digit_num > MAX_DIGIT

      s.each_char.with_index {|c, i| @digit[i] = c.to_i}
    end
  end

  def to_s
    @digit[0..(@digit_num - 1)].reverse.join("")
  end

  def to_i
    result = 0
    d = 1

    @digit[0..(@digit_num - 1)].each_with_index do |x, i|
      result += x * d
      d *= 10
    end

    result
  end

  def +(bi)
    raise TypeError unless bi.is_a?(Bigint)

    new_digit = @digit.dup
    new_digit_num = [@digit_num, bi.digit_num].max

    add = lambda {
      rec = lambda {|i, x|
        return if x.zero?

        raise OverflowError, "Sum is too big" unless i < MAX_DIGIT

        new_digit_num = i + 1 unless i < new_digit_num

        result = new_digit[i] + x
        new_digit[i] = result % 10

        # 桁上り
        rec[i + 1, 1] if result > 9
      }
    }.call

    bi.digit_num.times do |i|
      add[i, bi.digit[i]]
    end

    new2(new_digit_num, new_digit)
  end

  protected
  def digit
    @digit
  end

  def digit=(d)
    @digit = d
  end

  def digit_num=(n)
    @digit_num = n
  end

  private
  def new2(digit_num, digit)
    that = Bigint.new

    that.digit_num = digit_num
    that.digit = digit

    that
  end

  class OverflowError < Exception
  end
end

n = gets.to_i
n.times do
  remained_lines = 2
  begin
    remained_lines -= 1
    x = Bigint.new(gets.chomp)
    remained_lines -= 1
    y = Bigint.new(gets.chomp)
    puts (x + y)
  rescue Bigint::OverflowError
    puts "overflow"
  ensure
    remained_lines.times {gets}
  end
end