#include <bits/stdc++.h>
using namespace std;
using ll = long long;
std::vector<ll> bin(ll n) {
  vector<ll> binaryNum;
  while (n > 0) {
    binaryNum.push_back(n % 2);
    n = n / 2;
  }
  std::vector<ll> v;
  for (int i = binaryNum.size() - 1; i >= 0; --i) {
    v.push_back(binaryNum[i]);
  }
  return v;
}
ll ma(ll x, ll y) {
  if (x > y) {
    return x;
  } else {
    return y;
  }
}
ll mi(ll x, ll y) {
  if (x < y) {
    return x;
  } else {
    return y;
  }
}
ll binaryToDecimal(vector<ll> n) {
  ll dec_value = 0;
  ll base = 1;
  ll len = n.size();
  for (ll i = len - 1; i >= 0; i--) {
    if (n[i] == 1) dec_value += base;
    base = base * 2;
  }
  return dec_value;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll t;
  cin >> t;
  while (t--) {
    ll n, m;
    cin >> n >> m;
    cout << 2 * (m + n - 1) << "\n";
  }
  return 0;
}
