A hostel has N rooms in a straight line. It has to accommodate X people. Unfortunately, out of these X people, Y of them are infected with chickenpox. Due to safety norms, the following precaution must be taken:

No person should occupy a room directly adjacent to a room occupied by a chickenpox-infected person. In particular, two chickenpox-infected people cannot occupy adjacent rooms.

For example, if room 4 has a chickenpox-infected person, then nobody should occupy rooms 3 and 5. Similarly, if room 1 has a chickenpox-infected person then nobody should occupy room 2. 

What's the minimum value of N for which all the people can be accommodated in the hostel, following the above condition?

------ Input Format ------ 

- The first line of input contains a single integer T — the number of test cases. The description of T test cases follows.
- The first and only line of each test case contains two integers X and Y — the total number of people and the number of chickenpox-infected people.

------ Output Format ------ 

For each test case, output on a new line a single integer — the minimum value of N for which all the people can be accommodated in the hostel.

------ Constraints ------ 

$1 ≤ T ≤ 200$
$1 ≤ X ≤ 1000$
$0 ≤ Y ≤ X$

----- Sample Input 1 ------ 
3
4 0
5 3
3 3

----- Sample Output 1 ------ 
4
8
5

----- explanation 1 ------ 
Note: Below, $C$ represents a room occupied by a chickenpox-infected person, $N$ represents a room occupied by an uninfected person, and $\_$ represents an empty room.

Test case $1$: One of the possible ways to accommodate the people in $4$ rooms is:

$N$ $N$ $N$ $N$ 

Test case $2$: One of the possible ways to accommodate the people in $8$ rooms is:

$C$ $\_$ $C$ $\_$ $N$ $N$ $\_$ $C$ 

Test case $3$: One of the possible ways to accommodate the people in $5$ rooms is:

$C$ $\_$ $C$ $\_$ $C$

Difficulty: EASY

Solutions:
t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	if y == 0:
		print(x)
	elif y == x:
		print(1 + (y - 1) * 2)
	else:
		print(y * 2 + (x - y))


for i in range(int(input())):
	(x, y) = map(int, input().split())
	if x == y:
		print(x + y - 1)
	else:
		print(x + y)


tc = int(input())
for i in range(tc):
	(x, y) = map(int, input().split())
	nf = x - y
	if nf != 0:
		rooms = y * 2 + nf
	else:
		rooms = y * 2 - 1
	print(rooms)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	a = x - y
	if x == y:
		print(y + y - 1)
	else:
		print(y + y + a)


t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	x = l[0]
	y = l[1]
	if x == y:
		print(x + x - 1)
	elif y >= 0:
		print(x + y)


n = int(input())
for _ in range(n):
	(X, Y) = list(map(int, input().split()))
	rooms = 0
	for _ in range(Y):
		rooms += 2
	for _ in range(X - Y):
		rooms += 1
	if X - Y == 0:
		rooms -= 1
	print(rooms)


for t in range(int(input())):
	(x, y) = map(int, input().split())
	if x == y:
		print(y * 2 - 1)
	else:
		print(x + y)


fi = []

def myfunction2(n):
	if n == 0:
		return False
	else:
		if n == 1:
			fi.append(1)
		else:
			fi.append(1)
			fi.append(0)
		return myfunction2(n - 1)

def myfunction(n):
	if n == 0:
		return False
	else:
		fi.append(1)
		fi.append(0)
		return myfunction(n - 1)
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		myfunction2(b)
	else:
		myfunction(b)
	print(len(fi) + (a - b))
	fi = []


for i in range(int(input())):
	(X, Y) = map(int, input().split())
	if X - Y != 0:
		print(X - Y + Y * 2)
	elif X - Y == 0:
		print(Y * 2 - 1)


def code():
	cases = int(input())
	for _ in range(cases):
		(X, Y) = map(int, input().split(' '))
		if X == Y:
			print(X + Y - 1)
		else:
			print(X + Y)
code()


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print(a * 2 - 1)
	elif b == 0:
		print(a)
	else:
		print(b * 2 + (a - b))


T = int(input())
for i in range(T):
	(X, Y) = map(int, input().split())
	if X == Y:
		print(2 * Y - 1)
	else:
		print(X + Y)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = a - b
	if a == b:
		print(a + b - 1)
	else:
		print(b + b + c)


for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	if b == 0:
		print(a)
	elif a == b:
		print(a + b - 1)
	else:
		print(a + b)


T = int(input())
for _ in range(T):
	(X, Y) = map(int, input().split())
	print(X + Y - 1) if X == Y else print(X + Y)


for _ in range(int(input())):
	(X, Y) = map(int, input().split())
	if Y == 0:
		print(X)
	elif X == 0:
		print(abs(1 - Y * 2))
	elif X == Y:
		total_rooms = Y * 2 - 1 + (X - Y)
		print(total_rooms)
	else:
		total_rooms = Y * 2 + (X - Y)
		print(total_rooms)


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


t = int(input())
for i in range(t):
	(x, n) = map(int, input().split())
	c = n + (n - 1)
	if n == 0:
		print(x)
	elif x == n:
		print(c)
	else:
		p = x - n
		to = n + n
		print(p + to)


t = int(input())
for i in range(0, t):
	(m, n) = map(int, input().split(' '))
	if n == 0:
		print(m)
	elif m - n == 0:
		print(2 * n - 1)
	else:
		print(2 * n + (m - n))


for i in range(int(input())):
	(x, y) = map(int, input().split())
	if y == 0:
		print(x)
		continue
	infected = 2 * y
	if x - y == 0:
		print(infected - 1)
	else:
		print(infected + (x - y))


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


T = int(input())
for t in range(0, T):
	(P, p_sick) = map(int, input().split())
	p_well = P - p_sick
	if p_sick == P:
		min_rooms = 2 * P - 1
	elif p_sick == 0:
		min_rooms = p_well
	elif p_sick == 1:
		min_rooms = P + 1
	else:
		min_rooms = p_sick * 2 + p_well
	print(min_rooms)


t = int(input())
for i in range(t):
	(x, y) = [int(j) for j in input().split()]
	if x == y:
		print(y + y - 1)
	else:
		print(x - y + y * 2)


for i in range(int(input())):
	(total, chicken) = map(int, input().split())
	healthy = total - chicken
	res = chicken * 2 + healthy
	print(res - 1 if healthy == 0 else res)


try:
	t = int(input())
	for r in range(t):
		(x, y) = map(int, input().split())
		if y == 0:
			print(x)
		elif x > y:
			print(x + y)
		elif x == y:
			print(x + y - 1)
except:
	pass


t = int(input())
while t > 0:
	(x, y) = map(int, input().split())
	z = x - y
	if z == 0:
		print(y * 2 - 1)
	else:
		print(z + y * 2)
	t -= 1


for i in range(int(input())):
	l = input().split()
	X = int(l[0])
	Y = int(l[1])
	if X != Y:
		print(X - Y + 2 * Y)
	else:
		print(Y * 2 - 1)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if b == 0:
		print(a)
	elif a == b:
		print(2 * b - 1)
	else:
		print(a + b)


T = int(input())
for T in range(0, T):
	(X, Y) = map(int, input().split())
	if Y == 0:
		print(X)
	if X > Y and Y != 0:
		YY = Y * 2
		XX = X - Y
		print(YY + XX)
	if Y == X:
		print(Y * 2 - 1)


for t in range(int(input())):
	(a, b) = map(int, input().split())
	c = 0
	d = a - b
	if d != 0:
		print(d + b * 2)
	else:
		print(b * 2 - 1)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	x = a - b
	if x != 0:
		print(x + b * 2)
	else:
		print(b * 2 - 1)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	l = (2 * x + 1) * [0]
	n = 0
	rooms = 0
	i = x
	j = y
	while y > 0:
		if l[n] == 0:
			l[n] = 1
			l[n + 1] = 1
			y -= 1
			x -= 1
			n += 1
		else:
			n += 1
	if j == 0 or j == i:
		print(n + x)
	else:
		print(n + 1 + x)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	n = x - y
	if n == 0:
		print(y * 2 - 1)
	else:
		print(y * 2 + n)


T = int(input())
for i in range(T):
	(x, y) = map(int, input().split())
	l = x - y
	if x == 1:
		print(1)
	elif x == y:
		print(x + y - 1)
	else:
		print(x + y)