# Enter your code here. Read input from STDIN. Print output to STDOUT a, b, t = [int(i) for i in raw_input().split(' ')] m = int((a + b) * 0.5) mod = 10 ** 9 + 7 print pow(m, t, mod)