#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n;
int A, B;
int mmax, mmin;
cin >> n;
while(n--){
cin >> A >> B;
mmax = max(A, B);
mmin = min(A, B);
cout << 2*mmax + mmin << endl;
}
return 0;
}