arr = [int(x) for x in input().strip().split(' ')] a = arr[0] b = arr[1] t = arr[2] x = pow(int(.5*a +.5*b),t,1000000007) print(x)