import math modval = 10 ** 9 + 7 def rounder(x): if abs(x - int(x)) < 0.0000001: return int(x) return x def power(x, y): if y == 0: return 1 else: temp = power(x, y / 2) % modval if y % 2 == 0: return temp * temp % modval else: return x * temp * temp % modval a, b, t = map(int, raw_input().strip().split(' ')) retval = int(.5 * (a + b)) print int(power(retval, t))