(a, b, t) = tuple(map(int, input().split())) q = int(0.5*(a+b)) M = pow(10, 9) + 7 s = pow(q, t, M) print(s)