description: YouKn0wWho has two even integers x and y. Help him to find an integer n such that 1 ≤ n ≤ 2 ⋅ 10^{18} and n mod x = y mod n. Here, a mod b denotes the remainder of a after division by b. If there are multiple such integers, output any. It can be shown that such an integer always exists under the given constraints.
  
  Input
  
  The first line contains a single integer t (1 ≤ t ≤ 10^5) — the number of test cases.
  
  The first and only line of each test case contains two integers x and y (2 ≤ x, y ≤ 10^9, both are even).
  
  Output
  
  For each test case, print a single integer n (1 ≤ n ≤ 2 ⋅ 10^{18}) that satisfies the condition mentioned in the statement. If there are multiple such integers, output any. It can be shown that such an integer always exists under the given constraints.
  
  Example
  
  Input
  
  
  4
  4 8
  4 2
  420 420
  69420 42068
  
  
  Output
  
  
  4
  10
  420
  9969128
  
  Note
  
  In the first test case, 4 mod 4 = 8 mod 4 = 0.
  
  In the second test case, 10 mod 4 = 2 mod 10 = 2.
  
  In the third test case, 420 mod 420 = 420 mod 420 = 0.
solution: # This code is contributed by Siddharth
  
  
  from sys import *
  input = stdin.readline
  
  
  
  import threading
  from bisect import *
  import math
  from collections import *
  import operator
  from heapq import *
  from itertools import *
  inf=10**19
  mod=10**9+7
  MOD=998244353
  S1 = 'abcdefghijklmnopqrstuvwxyz'
  S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  dx = [-1,0]
  dy = [0,-1]
  # inverse modulo power pow(a,-1,mod) - it only works on py 3.8 ( *not in pypy )
  setrecursionlimit(200005)
  def asc(c):
      return ord(c)-97+1
  
  
  
  
  
  # ==========================================> Code Starts Here <=====================================================================)
  
  for _ in range(int(input())):
      x,y=map(int,input().split())
      if (x<y):
          print(y-((y%x)//2))
      elif x>y:
          print(x+y)
      else:
          print(x)