N = int(input()) from decimal import Decimal,ROUND_UP half = Decimal("0.5") for i in range(N): A,B = map(Decimal,input().split()) A **= half B **= half ans = (A+B).quantize(Decimal('0'), rounding=ROUND_UP) if (A+B) == ans: ans += 1 print(ans)