import java.math.BigInteger;
class Ackermann {
	public static BigInteger A(BigInteger x, BigInteger y){
	if (x.compareTo(BigInteger.ZERO) == 0 ) 
		return y.add(BigInteger.ONE);
	if (x.compareTo(BigInteger.ONE) == 0 ) 
		return y.add(BigInteger.valueOf(2));
	if (x.compareTo(BigInteger.valueOf(2)) == 0 ) 
		return (y.multiply(BigInteger.valueOf(2))).add(BigInteger.valueOf(3));
	if (y.compareTo(BigInteger.ZERO) == 0 )
		return A(x.subtract(BigInteger.ONE),BigInteger.ONE);
	return A(x.subtract(BigInteger.ONE),A(x,y.subtract(BigInteger.ONE)));
  }
  public static void main(String args[]) {
    BigInteger m=new BigInteger(args[0]); 
    BigInteger n=new BigInteger(args[1]);
    BigInteger a=A(m,n);
    System.out.println("Fertig...");
    System.out.println(a.toString());
  }
}
