# Enter your code here. Read input from STDIN. Print output to STDOUT a,b,t = raw_input().split() a,b,t = int(a),int(b),int(t) n = (a+b)/2 def Pow(a,n): res = 1; while n: if n%2 == 1: res = res * a n -= 1 else: a = a*a n = n/2 if a>10**9+7: a = a%(10**9+7) return res%(10**9+7) def myPow( x, n): if n == 0: return 1 if n == 1: return x if n == -1: return 1/x if n==2: return x*x if n == -2: return 1/(x*x) if n>0: if n%2 == 0: return myPow(x,n/2)**2 else: return myPow(x,(n-1)/2)**2*x else: if n%2 == 0: return myPow(x,n/2)**2 else: return myPow(x,(n-1)/2)**2*x print Pow(n,t)%(10**9+7)