a, b, t = [int(i) for i in input().strip().split(' ')] n = 0.5*a + 0.5*b res = int(pow(n,t)) % (int(pow(10,9)+7)) print(res)