#include<stdio.h>
int main()
{
__int64 x,m,n;
while(scanf("%I64d%I64d",&n,&m)!=EOF){
if(n==0&&m==0)break;
x=n+m-2;
printf("%I64d\n",x);}
}
int main()
{
__int64 x,m,n;
while(scanf("%I64d%I64d",&n,&m)!=EOF){
if(n==0&&m==0)break;
x=n+m-2;
printf("%I64d\n",x);}
}