#!/usr/bin/python
#Copyleft (C) 1996 William Totten
#biell@udel.edu

#This program implements ackerman's number generating alogithim.
#Recurrence relation:
#ack(1,y)=y+1
#ack(x,1)=ack(x-1,2)
#ack(x,y)=ack(x-1, ack(x,y-1))

#Recursive implementation of the algorithm
def ack(x,y):
	if(x==1):
		return y+1
	elif(y==1):
		return ack(x-1, 2)
	else:
		return ack(x-1, ack(x,y-1))

if __name__ == '__main__':
	from sys import argv
	from posix import times
	x=eval(argv[1])
	y=eval(argv[2])
	t=times()[0]
	print "Ackerman: ", ack(x, y), ", User Time: ", times()[0] - t
