Problem: Tired of playing Counter strike at every fest, well we can't do anything about it but we can sure give you a new game to play regardless of the fact that it ain't anything like GTA V or Mad Max but it sure can get you one step closer to glory you are entitled for.   

So the rules are simple we would provide you with first(A) and second(B) number of the series and the rest you have to figure out by the given formula. To simplify it we will give you the first and second number of the series and will ask you to calculate the Nth number of that series.  

To calculate I(n+2) =(I(n+1))^2 +I(n) 
So, if the first two terms of the series are 0 and 1: 
the third term = 1^2 + 0 = 1
fourth term = 1^2 + 1 = 2 
fifth term = 2^2 + 1 = 5 
... And so on.

Input format:
Three spaced integer. First is A, second is B and third is Nth number you’ve to calculate.

Output format:
One integer i.e the Nth number of the series when the first and second number of the series A and B are given.

Constraints:
A ≥ 0
B ≥ 0
0 < N < 9,223,372,036,854,775,807

SAMPLE INPUT
0 1 5

SAMPLE OUTPUT
5

Solution (in PYTHON):

Solution:
a = [int(x) for x in raw_input().split(' ') if x!='']

for i in range(2,a[2]):
	t = a[1]*a[1] + a[0];
	a[0]=a[1]
	a[1]=t
	
print t