#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
int t;
cin>>t;
while(t--)
{
int a,b;
cin>>a>>b;
int temp1=a*2+b;
int temp2=a+2*b;
int temp3=max(temp1,temp2);
cout<<temp3<<endl;
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
int t;
cin>>t;
while(t--)
{
int a,b;
cin>>a>>b;
int temp1=a*2+b;
int temp2=a+2*b;
int temp3=max(temp1,temp2);
cout<<temp3<<endl;
}
return 0;
}