import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; //import java.math.BigInteger; public class Solution { /* static int power(int x, unsigned int y){ int temp; if(y == 0) return 1; temp = power(x, y/2); if (y%2 == 0) return temp*temp; else return x*temp*temp; } */ public static void main(String[] args) { Scanner scan = new Scanner(System.in); BigInteger a=scan.nextBigInteger(); BigInteger b=scan.nextBigInteger(); BigInteger t = scan.nextBigInteger(); BigInteger rez=a.add(b).divide(BigInteger.valueOf(2)); System.out.println(rez.modPow(t,BigInteger.valueOf(1000000007))); } }