-----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.

Starter code:

Solutions:
from math import factorial

for _ in range(int(input())):
 N,M=[int(a) for a in input().split()]
 print(float(N+M-1))

for _ in range(int(input())):
 n ,m = map(int,input().split())
 if n==1 or m==1:
  print(max(n,m))
 else:
  print(n+m-1)

for i in range(int(input())):
 a,b = list(map(int, input().split()))
 print(a+b-1)
   


# cook your dish here
for _ in range(int(input())):
 n,m=list(map(int,input().split()))
 print(m+n-1)


# cook your dish here
for _ in range(int(input())):
 N,M=map(int,input().split())
 print("{:.6f}".format(N+M-1))

for _ in range(int(input())):
 N,M=map(int,input().split())
 print("{:.6f}".format(N+M-1))

for t in range(int(input())):
 n,m=map(int,input().split())
 print(m+n-1)

try:
 t = int(input())
 for _ in range(t):
  N, M = map(int, input().rstrip().split())
  print(N + M - 1)
except:
 pass

# cook your dish here
try:
 t = int(input())
 for _ in range(t):
  N, M = map(int, input().rstrip().split())
  print(N + M - 1)
except:
 pass

for _ in range(int(input())):
 n,m=map(int,input().split())
 t_1=n+m-1
 print('%.6f'%t_1)

# cook your dish here
t=int(input())
while t:
 n,m=map(int,input().split())
 print(n+m-1)
 t-=1

t=int(input())
for _ in range(t):
 n,m=list(map(int,input().strip().split()))
 print(n+m-1)


# cook your dish here
try:
 def fun(t):
  for i in range(t):
   n,m=map(int,input().split())
   j=n+m-1
   print("{:.6f}".format(j))
 fun(int(input()))
except:
 pass

test=int(input())
for _ in range(test):
 n,m=map(float,input().split())
 print(n+m-1)

# cook your dish here
for _ in range(int(input())):
 n,m=map(float,input().split())
 print(n+m-1)

# cook your dish here
"""
At first when you look at the problem you nitice that it may be a depth search     problem
so you made a column and row number form yourself and readlised that all     diagonals
add to one.

so the total number of diagonals will be a+b-1

for 3*4 matrix

1         0.5       0.25              0.125
0.5       0.5       0.375             0.375/2 + 0.125
0.25      0.5       0.375/2+0.5       1

use depth search approach to get the individual probability 
"""

testcase = int (eval(input()))
for z in range(testcase):
 a,b = [int(d) for d in input().split()]
 print(a+b-1)


# cook your dish here
for _ in range(int(input())):
 n,m=map(float,input().split())
 print(n+m-1)

# cook your dish here
n=int(input())
for i in range(n):
 s=input().split(" ")
 s[0]=int(s[0])
 s[1]=int(s[1])
 print(s[0]+s[1]-1)

# cook your dish here
for _ in range(int(input())) :
 m,n = map(int , input().split(" "))
 print(m+n-1)

T = int(input())
for i in range(T):
 n, m = list(map(int, input().split()))
 print(n + m - 1)

for _ in range(int(input())):
 n,m=map(int,input().split())
 print(n+m-1)

def __starting_point():
 TC = int(input())
 for _ in range(TC):
  ROWS, COLS = list(map(int, input().strip().split()))
  print(f"{ROWS + COLS - 1}.000000")
__starting_point()

# cook your dish here
num_cases = int(input())
for nidx in range(num_cases):
 z=input().split()
 n=int(z[0])
 m=int(z[1])
 print(n+m-1)

import sys
import math
import bisect

def main():
 for _ in range(int(input())):
  n, m = list(map(int, input().split()))
  val = (n + m - 1) * 1.0
  print('%.6f' % val)

def __starting_point():
 main()

__starting_point()