A. Crossmarket
#include<cstdio>
#include<cstring>
#include<stdlib.h>
#include<algorithm>
#include<iostream>
#include<vector>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include<math.h>
#define ll long long
using namespace std;
const int mod=1e9+7;
const int INF=0x3f3f3f3f;
inline int read()
{
int x=0,f=1;
char c=getchar();
while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
while(c>='0'&&c<='9'){x=x*10+c-'0',c=getchar();}
return x*f;
}
void solve()
{
int n=read(),m=read();
if(n==1&&m==1)
{
printf("0\n");
return;
}
if(m>n)swap(n,m);
printf("%d\n",n-1+m-1+m);
}
int main()
{
int T=read();
while(T--)solve();
return 0;
}
B. Beaut