import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner get=new Scanner(System.in); int a=get.nextInt(); int b=get.nextInt(); long t=get.nextLong(); int x=(int) (0.5*a+0.5*b); long num=1; int mod=1000000007; num=fastpow(x,t-1,mod); //System.out.println(den); System.out.println((num*x)%mod); } public static long fastpow(long a,long b,int mod) { long ans=1; while(b!=0) { if(b%2==1) { ans=(ans*a)%mod; } a*=a; a%=mod; b/=2; } return ans; } }