import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) throws Exception { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String input = in.readLine(); String is[] = input.split(" "); long a = Long.parseLong(is[0]); long b = Long.parseLong(is[1]); long t = Long.parseLong(is[2]); //double x = ((a+b)/2); //double res = Math.pow(x, t); //System.out.println((long)(res % (Math.pow(10, 9) + 7))); long p = (long)(Math.pow(10, 9) + 7); long x = (long)((a+b)/2); long res = 1; while(t > 0) { if((t & 1) != 0) //t is odd res = (res*x) % p; //t even t = t>>1; // t = t/2 x = (x*x) % p; } System.out.println(res); } }