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) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner scan = new Scanner (System.in); BigInteger a = new BigInteger(scan.next()); BigInteger b = new BigInteger(scan.next()); BigInteger t = new BigInteger(scan.next()); scan.close(); BigInteger answer = new BigInteger("0"); answer = answer.add(a); answer = answer.add(b); answer = answer.divide(new BigInteger("2")); answer = answer.modPow(t, new BigInteger("1000000007")); System.out.println(answer.toString()); } }