http://acm.hdu.edu.cn/showproblem.php?pid=1165
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std ;
#define INT __int64
INT dfs( INT m , INT n )
{
if( n == 0 )
dfs( m - 1 , 1 ) ;
else if( m == 0 )
return n + 2;
else if( m == 1 )
return n + 2 ;
else if( m == 2 )
return 2 * n + 3;
else if( m == 3 )
return dfs( m , n - 1 ) * 2 + 3;
}
int main()
{
INT m , n ;
while( cin >> m >> n )
{
cout << dfs( m , n ) << endl ;
}
return 0;
}