import java.io.*; import java.util.*; class Solution { long ans(long n,long t) { long res=1; while(t>0) { if(t%2!=0) res=(res*n)%1000000007; t=t/2; n=(n*n)%1000000007; } return res; } public static void main(String[] args) { Scanner sc=new Scanner(System.in); int a,b; long t,res; a=sc.nextInt(); b=sc.nextInt(); t=sc.nextLong(); long c=(long)((a+b)*0.5); Solution s=new Solution(); res=s.ans(c,t); System.out.println(res); } }