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 in = new Scanner(System.in); BigInteger a = new BigInteger(in.next()); BigInteger b = new BigInteger(in.next()); BigInteger t = new BigInteger(in.next()); BigInteger branchingFactor = a.add(b).divide(new BigInteger("2")); BigInteger mod = (new BigInteger("10")).pow(9).add(new BigInteger("7")); System.out.println(branchingFactor.modPow(t, mod)); } }