# Enter your code here. Read input from STDIN. Print output to STDOUT input_str = raw_input() input_str = input_str.strip().split(" ") input_str = map(lambda x:int(x),input_str) a,b,t = input_str MOD = 10**9+7 def fast_exp(base, exp): res=1 while(exp>0): if(exp%2==1): res=(res*base)%MOD base=(base*base)%MOD exp/=2 return res%MOD result = (fast_exp(int(0.5*a+0.5*b),t)) print result