# Enter your code here. Read input from STDIN. Print output to STDOUT def po(x,y): if y == 0: return 1 t = po(x,y/2) t = t%(10**9+7) if y%2 == 0: return (t*t)%(10**9+7) else: return (x*t*t)%(10**9+7) a,b,n = map(int,raw_input().split()) p = int(0.5*(a+b)) print int(po(p,n))%(10**9+7)