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

1000000000 

//package currentContest;
 
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Random;
import java.util.StringTokenizer;

public class P4 {
	static int N = 1000001;
 
	// Array to store inverse of 1 to N
	static long[] factorialNumInverse = new long[N + 1];
 
	// Array to precompute inverse of 1! to N!
	static long[] naturalNumInverse = new long[N + 1];
 
	// Array to store factorial of first N numbers
	static long[] fact = new long[N + 1];
 
	// Function to precompute inverse of numbers
	public static void InverseofNumber(int p) {
		naturalNumInverse[0] = naturalNumInverse[1] = 1;
 
		for (int i = 2; i <= N; i++)
			naturalNumInverse[i] = naturalNumInverse[p % i] * (long) (p - p / i) % p;
	}
 
	// Function to precompute inverse of factorials
	public static void InverseofFactorial(int p) {
		factorialNumInverse[0] = factorialNumInverse[1] = 1;
 
		// Precompute inverse of natural numbers
		for (int i = 2; i <= N; i++)
			factorialNumInverse[i] = (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p;
	}
 
	// Function to calculate factorial of 1 to N
	public static void factorial(int p) {
		fact[0] = 1;
 
		// Precompute factorials
		for (int i = 1; i <= N; i++) {
			fact[i] = (fact[i - 1] * (long) i) % p;
		}
	}
 
	// Function to return nCr % p in O(1) time
	public static long Binomial(int N, int R, int p) {
 
		// n C r = n!*inverse(r!)*inverse((n-r)!)
		long ans = ((fact[N] * factorialNumInverse[R]) % p * factorialNumInverse[N - R]) % p;
 
		return ans;
	}
 
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader sc = new FastReader();
		int t=sc.nextInt();
		StringBuilder st=new StringBuilder();
		while(t--!=0) {
			long x=sc.nextLong();
			long y=sc.nextLong();
			if(x==y) {
				st.append(x+"\n");
			}else if(x>y) {
				st.append(x+y+"\n");
			}else {
				long ans=(long) ((y/x)*x+(y%((y/x)*x))/2);
				st.append(ans+"\n");
			}
		}
		System.out.println(st);
	}
	public static long gcd1(long a, long b) {
		if (a == 0) {
			return b;
		}
		return gcd1(b % a, a);
	}

	static FastReader sc = new FastReader();
 
	public static void solvegraph() {
		int n = sc.nextInt();
 
		int edge[][] = new int[n - 1][2];
		for (int i = 0; i < n - 1; i++) {
			edge[i][0] = sc.nextInt() - 1;
			edge[i][1] = sc.nextInt() - 1;
		}
		ArrayList<ArrayList<Integer>> ad = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			ad.add(new ArrayList<Integer>());
		}
		for (int i = 0; i < n - 1; i++) {
			ad.get(edge[i][0]).add(edge[i][1]);
			ad.get(edge[i][1]).add(edge[i][0]);
		}
		int parent[] = new int[n];
		Arrays.fill(parent, -1);
		parent[0] = n;
		ArrayDeque<Integer> queue = new ArrayDeque<>();
		queue.add(0);
		int child[] = new int[n];
		Arrays.fill(child, 0);
		ArrayList<Integer> lv = new ArrayList<Integer>();
		while (!queue.isEmpty()) {
			int toget = queue.getFirst();
			queue.removeFirst();
			child[toget] = ad.get(toget).size() - 1;
			for (int i = 0; i < ad.get(toget).size(); i++) {
				if (parent[ad.get(toget).get(i)] == -1) {
					parent[ad.get(toget).get(i)] = toget;
					queue.addLast(ad.get(toget).get(i));
				}
			}
			lv.add(toget);
		}
 
		child[0]++;
	}
 
	static void sort(int[] A) {
		int n = A.length;
		Random rnd = new Random();
		for (int i = 0; i < n; ++i) {
			int tmp = A[i];
			int randomPos = i + rnd.nextInt(n - i);
			A[i] = A[randomPos];
			A[randomPos] = tmp;
		}
		Arrays.sort(A);
	}
 
	static void sort(long[] A) {
		int n = A.length;
		Random rnd = new Random();
		for (int i = 0; i < n; ++i) {
			long tmp = A[i];
			int randomPos = i + rnd.nextInt(n - i);
			A[i] = A[randomPos];
			A[randomPos] = tmp;
		}
		Arrays.sort(A);
	}
 
	static String sort(String s) {
		Character ch[] = new Character[s.length()];
		for (int i = 0; i < s.length(); i++) {
			ch[i] = s.charAt(i);
		}
		Arrays.sort(ch);
		StringBuffer st = new StringBuffer("");
		for (int i = 0; i < s.length(); i++) {
			st.append(ch[i]);
		}
		return st.toString();
	}
 
	public static long gcd(long a, long b) {
		if (a == 0) {
			return b;
		}
		return gcd1(b % a, a);
	}
 
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}