import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); int b = in.nextInt(); long ms = in.nextLong(); int m = 1000000007; long k = (long)(0.5*(a+b)); //int answer = power(k, ms); int answer = (int)pow(k, ms); System.out.print(answer); } public static int power(int x, int y) { int m = 1000000007; int temp; x = x; if(y == 0) return 1; temp = power(x, y/2); if (y%2 == 0) return (temp*temp) % m; else return (x*temp*temp) % m; } public static long pow(long m, long n) { long mo = 1000000007; if (n <= 0) { return 1; // Be lazy first } else if (n % 2 == 1) { return m * pow(m, n - 1) % mo; // Normal slow strategy } else { // n even long root = pow(m, n / 2); // Do not evaluate twice return root * root % mo; } } }