def modulo (base, exp, mod): if mod == 1: return 0 c = 1 for e in range(1, exp+1): c = (c*base) % mod return c def modulo2 (base, exp, mod): if mod == 1: return 0 result = 1 base = base % mod while exp > 0: if exp % 2 == 1: result = (result*base) % mod exp = exp >> 1 base = (base*base) % mod return result def modulo3(x,e,m): X = x E = e Y = 1 while E > 0: if E % 2 == 0: X = (X * X) % m E = E/2 else: Y = (X * Y) % m E = E - 1 return Y A = input().strip().split() a, b, t = [int(A[0]),int(A[1]),int(A[2])] a2 = a / 2 b2 = b / 2 def binconvert(n): barray = [] if n == 0: return 0 while n > 0: #barray = n%2 + barray[:] barray.append(n%2) n = n >> 1 barray.reverse() return barray def modulo4(y, x, n): #convert x to a binary list x = binconvert(x) s = [1] r = x[:] for k in range (0, len(x)): if x[k] == 1: r[k] = (s[k] * y) % n else: r[k] = s[k] s.append ((r[k]**2)%n) #print s #print r return r[-1] def modulo5(y, x, n): a = x b = 1 c = y while a != 0: if a % 2 == 0: a = a/2 c = (c**2) % n else: a = a -1 b = (b * c) % n return b c = modulo2(int(a2+b2), t, (1000000007)) #c = (a/2+b/2)**t % (10**9 + 7) #for i in range(1,t+1): # c = (a2 * c + b2 * c) % (10**9 + 7) print(int(c) )