You have a list of numbers from 1 to n written from left to right on the blackboard.

You perform an algorithm consisting of several steps (steps are 1-indexed). On the i-th step you wipe the i-th number (considering only remaining numbers). You wipe the whole number (not one digit).

<image>

When there are less than i numbers remaining, you stop your algorithm. 

Now you wonder: what is the value of the x-th remaining number after the algorithm is stopped?

Input

The first line contains one integer T (1 ≤ T ≤ 100) — the number of queries. The next T lines contain queries — one per line. All queries are independent.

Each line contains two space-separated integers n and x (1 ≤ x < n ≤ 10^{9}) — the length of the list and the position we wonder about. It's guaranteed that after the algorithm ends, the list will still contain at least x numbers.

Output

Print T integers (one per query) — the values of the x-th number after performing the algorithm for the corresponding queries.

Example

Input


3
3 1
4 2
69 6


Output


2
4
12
#include <bits/stdc++.h>
namespace std {
bool __LOG_ = false;
const int N = 200002;
const int logN = 20;
const int MOD7 = 1000000007;
const long long MOD9 = 998244353;
const long long MODL = 1000000007;
const int INF = 1000000007;
const long long INFL = 4ll * 1000000007ll * 1000000007ll;
const long double PI = acos(-1);
const int HPRIME = 31;
const long double EPS = 1e-30;
inline void No() { printf("NO\n"); }
inline void Yes() { printf("YES\n"); }
template <typename T1, typename T2>
std::istream &operator>>(std::istream &in, std::pair<T1, T2> &p) {
  return in >> p.first >> p.second;
}
template <typename T1, typename T2>
std::ostream &operator<<(std::ostream &out, const std::pair<T1, T2> p) {
  return out << p.first << " " << p.second;
}
template <typename T>
std::istream &operator>>(std::istream &in, vector<T> &vec) {
  for (auto &x : vec) {
    in >> x;
  }
  return in;
}
template <typename T>
std::ostream &operator<<(std::ostream &out, const vector<T> &vec) {
  for (auto x : vec) {
    out << x << " ";
  }
  return out;
}
template <typename T1, typename T2>
std::vector<T1> &operator+=(std::vector<T1> &a, const std::vector<T2> &b) {
  assert(a.size() == b.size());
  for (size_t i = 0; i < a.size(); ++i) {
    a[i] += b[i];
  }
  return a;
}
template <typename T1, typename T2>
std::vector<T1> &operator-=(std::vector<T1> &a, const std::vector<T2> &b) {
  assert(a.size() == b.size());
  for (size_t i = 0; i < a.size(); ++i) {
    a[i] -= b[i];
  }
  return a;
}
template <typename T1, typename T2>
std::vector<T1> &operator*=(std::vector<T1> &a, const std::vector<T2> &b) {
  assert(a.size() == b.size());
  for (size_t i = 0; i < a.size(); ++i) {
    a[i] *= b[i];
  }
  return a;
}
template <typename T1, typename T2>
std::vector<T1> &operator/=(std::vector<T1> &a, const std::vector<T2> &b) {
  assert(a.size() == b.size());
  for (size_t i = 0; i < a.size(); ++i) {
    a[i] /= b[i];
  }
  return a;
}
template <typename T>
std::vector<T> operator+(const std::vector<T> &a, const std::vector<T> &b) {
  std::vector<T> ans(a);
  ans += b;
  return ans;
}
template <typename T>
std::vector<T> operator-(const std::vector<T> &a, const std::vector<T> &b) {
  std::vector<T> ans(a);
  ans -= b;
  return ans;
}
template <typename T>
std::vector<T> operator*(const std::vector<T> &a, const std::vector<T> &b) {
  std::vector<T> ans(a);
  ans *= b;
  return ans;
}
template <typename T>
std::vector<T> operator/(const std::vector<T> &a, const std::vector<T> &b) {
  std::vector<T> ans(a);
  ans /= b;
  return ans;
}
template <typename T>
T max(std::vector<T> v) {
  T ans = v[0];
  for (auto x : v) {
    ans = std::max(ans, x);
  }
  return ans;
}
template <typename T>
T min(std::vector<T> v) {
  T ans = v[0];
  for (auto x : v) {
    ans = std::min(ans, x);
  }
  return ans;
}
template <typename T1, typename T2>
std::pair<T1, T2> operator+(const std::pair<T1, T2> &a,
                            const std::pair<T1, T2> &b) {
  return std::pair<T1, T2>(a.first + b.first, a.second + b.second);
}
template <typename T1, typename T2>
std::pair<T1, T2> operator-(const std::pair<T1, T2> &a,
                            const std::pair<T1, T2> &b) {
  return std::pair<T1, T2>(a.first - b.first, a.second - b.second);
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
void fastIO() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.setf(ios::fixed);
  cout.precision(10);
}
bool prime(long long n) {
  if (n == 1) return false;
  if (n == 2) return true;
  if (n % 2 == 0) return false;
  for (long long i = 3; i * i <= n; i += 2) {
    if (n % i == 0) return false;
  }
  return true;
}
long long binpow(long long a, long long b, long long mod = MOD7) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res = (res * a) % mod;
    }
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
}  // namespace std
using namespace std;
void precalc() {}
void solve() {
  int n, x;
  cin >> n >> x;
  cout << 2 * x << endl;
}
int main() {
  __LOG_ = true;
  fastIO();
  precalc();
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
