#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
long long mx = 1e9 + 7;
long long power(long long x, long long n) {
  if (n == 0) return 1;
  if (n == 1) return x;
  long long ret = power(x, n / 2);
  if (n % 2 == 0)
    return (ret * ret) % mx;
  else
    return ((ret * ret) % mx * x) % mx;
}
vector<long long> fac(2e5 + 5, 1);
long long inv(long long a) { return (power(a, mod - 2) % mod + mod) % mod; }
long long binom(long long x, long long y) {
  if (x < 0 || y < 0) return 0;
  return (((fac[x] * inv(fac[y])) % mod * inv(fac[x - y])) % mod + mod) % mod;
}
bool isPrime(long long n) {
  static long long i = 2;
  if (n == 0 || n == 1) {
    return false;
  }
  if (n == i) return true;
  if (n % i == 0) {
    return false;
  }
  i++;
  return isPrime(n);
}
string ffs(long long i) {
  if (i == 0)
    return "";
  else
    return ffs((i - 1) / 26) + char((i - 1) % 26 + 'a');
}
const long long ftr = 4e5 + 5;
const long long mod22 = 1e9 + 7;
bool checkcycle[ftr];
vector<long long> adj[ftr];
void rotatecycle(long long y) {
  checkcycle[y] = true;
  for (auto x : adj[y]) {
    if (!checkcycle[x]) rotatecycle(x);
  }
}
bool isPal(string &str) {
  long long l = 0;
  long long h = (long long)str.size() - 1;
  while (l < h) {
    if (str[l++] != str[h--]) {
      return false;
    }
  }
  return true;
}
long long xxxor(long long n) {
  if (n % 4 == 0) {
    return n;
  }
  if (n % 4 == 1) {
    return 1;
  }
  if (n % 4 == 2) {
    return n + 1;
  }
  return 0;
}
bool sortbysec(const pair<long long, long long> &a,
               const pair<long long, long long> &b) {
  return (a.second < b.second);
}
bool sortbysecgt(const pair<long long, long long> &a,
                 const pair<long long, long long> &b) {
  return (a.second > b.second);
}
const long long mmt = 1e14;
long long factorial(long long n) {
  long long res = 1;
  for (long long i = 1; i <= n; i++) {
    res = (res * i) % mmt;
  }
  return res;
}
void solve() {
  long long x, y;
  cin >> x >> y;
  long long out = 0;
  if (x > y) {
    cout << (x + y) << '\n';
  } else {
    out = (x + y) / 2;
    out %= x;
    y -= out;
    cout << y << "\n";
  }
}
int32_t main() {
  long long t;
  cin >> t;
  long long ind = 0;
  long long idx = 0;
  priority_queue<pair<long long, long long>> pq;
  vector<bool> vis(500005, false);
  long long mni = 1e9 + 7;
  while (t--) {
    solve();
  }
  return 0;
}

### Prompt

Your task is to create a Cpp solution to the following problem:

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.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
long long mx = 1e9 + 7;
long long power(long long x, long long n) {
  if (n == 0) return 1;
  if (n == 1) return x;
  long long ret = power(x, n / 2);
  if (n % 2 == 0)
    return (ret * ret) % mx;
  else
    return ((ret * ret) % mx * x) % mx;
}
vector<long long> fac(2e5 + 5, 1);
long long inv(long long a) { return (power(a, mod - 2) % mod + mod) % mod; }
long long binom(long long x, long long y) {
  if (x < 0 || y < 0) return 0;
  return (((fac[x] * inv(fac[y])) % mod * inv(fac[x - y])) % mod + mod) % mod;
}
bool isPrime(long long n) {
  static long long i = 2;
  if (n == 0 || n == 1) {
    return false;
  }
  if (n == i) return true;
  if (n % i == 0) {
    return false;
  }
  i++;
  return isPrime(n);
}
string ffs(long long i) {
  if (i == 0)
    return "";
  else
    return ffs((i - 1) / 26) + char((i - 1) % 26 + 'a');
}
const long long ftr = 4e5 + 5;
const long long mod22 = 1e9 + 7;
bool checkcycle[ftr];
vector<long long> adj[ftr];
void rotatecycle(long long y) {
  checkcycle[y] = true;
  for (auto x : adj[y]) {
    if (!checkcycle[x]) rotatecycle(x);
  }
}
bool isPal(string &str) {
  long long l = 0;
  long long h = (long long)str.size() - 1;
  while (l < h) {
    if (str[l++] != str[h--]) {
      return false;
    }
  }
  return true;
}
long long xxxor(long long n) {
  if (n % 4 == 0) {
    return n;
  }
  if (n % 4 == 1) {
    return 1;
  }
  if (n % 4 == 2) {
    return n + 1;
  }
  return 0;
}
bool sortbysec(const pair<long long, long long> &a,
               const pair<long long, long long> &b) {
  return (a.second < b.second);
}
bool sortbysecgt(const pair<long long, long long> &a,
                 const pair<long long, long long> &b) {
  return (a.second > b.second);
}
const long long mmt = 1e14;
long long factorial(long long n) {
  long long res = 1;
  for (long long i = 1; i <= n; i++) {
    res = (res * i) % mmt;
  }
  return res;
}
void solve() {
  long long x, y;
  cin >> x >> y;
  long long out = 0;
  if (x > y) {
    cout << (x + y) << '\n';
  } else {
    out = (x + y) / 2;
    out %= x;
    y -= out;
    cout << y << "\n";
  }
}
int32_t main() {
  long long t;
  cin >> t;
  long long ind = 0;
  long long idx = 0;
  priority_queue<pair<long long, long long>> pq;
  vector<bool> vis(500005, false);
  long long mni = 1e9 + 7;
  while (t--) {
    solve();
  }
  return 0;
}

```