import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.math.BigInteger; import java.util.regex.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String input; String [] tokens = null; while((input=br.readLine())!=null) { tokens = input.split(" "); } BigInteger a = new BigInteger(tokens[0]); BigInteger b = new BigInteger(tokens[1]); BigInteger exponent = new BigInteger(tokens[2]); BigInteger result = a.add(b); result = result.divide(new BigInteger("2")); result = result.modPow(exponent, new BigInteger("1000000007")); System.out.println(result); }catch(IOException io) { io.printStackTrace(); } } }