def mod_pow(x,t,mod) : if t == 1 : return x elif t%2 == 1 : y = (mod_pow(x,t//2,mod)) return (y*y*mod_pow(x,1,mod))%mod else : y = (mod_pow(x,t//2,mod)) return (y*y)%mod a,b,t = input().strip().split() a,b,t = int(a),int(b),int(t) expected_value = mod_pow(int(0.5*(a+b)),t,10**9+7) print(int(expected_value))