Problem: Problem description
As a holiday gift, Tojo received a probability problem. The problem read as follows
Consider an N by M grid. Rows are numbered 1 to N, from top to bottom. Columns are numbered 1 to M, from left to right. You are initially at cell (1, 1) and want to go to cell (N, M). From any cell you can move to the cell below it or to the cell right to it. You should never go out of the grid. At any point you should consider all the possibilities of movement with equal probability
Let P[i][j] be the probability of visiting cell (i, j). You need to calculate the sum of P[i][j] for 1 ≤ i ≤ N, 1 ≤ i ≤ M.
As we all know, Tojo really hates probability related problems. He wants you to solve this task

Input
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.Only line of each test case has two integer N and M.

Output
For each test case, output a single line containing the required answer. Answers within an absolute or relative error of 10^-6 will be accepted.

Constraints

1 ≤ T ≤ 1000
1 ≤ N ≤ 1000
1 ≤ M ≤ 1000


Example
Input:
2
2 2
1 6

Output:
3.000000
6.000000

Explanation
Example case 1
Probability matrix P for N=2, M=2 is
1.0 0.5
0.5 1.0
You are at (1, 1) initially. So the probablity of visiting (1, 1) is 1. At (1, 1) you have 2 options, move below to (2, 1) or to right cell (1, 2). Probablity of going to (1, 2) is 0.5. Probability of going to (2, 1) is 0.5. You always end up at (2, 2), so P[2][2] is 1. Required sum = 1.0 + 0.5 + 0.5 + 1.0 = 3.0
Example case 2
Probability matrix P for N=1, M=6 is
1.0 1.0 1.0 1.0 1.0 1.0
Because at any position there is only one possible next position.

Solution (in PYTHON):

Solution:
"""
Tojo Hates Probability:

Given a N x M grid, and we need to move from 1 x 1 to N x M.
Also, we can only move down or right, and cannot move out of the grid.
Suppose we start at (1,1) then the only two options are (1,2) or (2,1).
SO the probability of moving to these two points will be 0.5 and 0.5
Now, if we were to count the number of steps it takes to reach each cell
of a 3 x 4 grid, it would look like this:
0 1 2 3
1 2 3 4
2 3 4 5

We observe that for any diagonal (right to left) we would need the same
number of steps to reach a cell, So the sum of probabilities across these
diagonal elements will be 1.
1     0.5     0.25     0.125
0.5   0.5     0.375    0.3125
0.25  0.5     0.6875   1

So, sum across every diagonal equals 1.
Thus, sum across the grid  = (number of diagonals) * (1)
"""


def probability_sum(n, m):
    return n + m - 1


if __name__ == '__main__':
    tests = int(raw_input())
    for _ in xrange(tests):
        n, m = map(int, raw_input().split())
        print '%.6f' % probability_sum(n, m)