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 scanner = new Scanner(System.in); long a = scanner.nextInt(); long b = scanner.nextInt(); // long t = scanner.nextInt(); BigInteger t = new BigInteger(scanner.next()); //(.5*(a+b))^t // BigInteger base =new BigInteger(String.valueOf((a+b)/2)); BigInteger m = new BigInteger(String.valueOf(1000000007)); // long base = (a+b)/2; // long v = expo(base,t); BigInteger base = new BigInteger(String.valueOf((int) (0.5*(a+b)))); BigInteger result = base.modPow(t,m); System.out.print(result); } }