def growth(a,b,t): k=int((0.5*a)+(0.5*b)) x=pow(k,t,((10**9)+7)) print x n = map(int,raw_input().strip().split()) a_ = n[0] b_ = n[1] t_ = n[2] growth(a_,b_,t_)