import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Hii { public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line[] = br.readLine().split(" "); BigInteger res = new BigInteger("0"); BigInteger b1,b2,b3,modu; modu = new BigInteger("1000000007"); // public BigInteger modPow(BigInteger exponent, BigInteger m) b1 = new BigInteger(line[0]); b2 = new BigInteger(line[1]); b3 = new BigInteger(line[2]); //b1 = b1.modPow(b3,modu); //b2 = b2.modPow(b3,modu); res = (b1.add(b2)).mod(modu); res = res.divide(new BigInteger("2")); res = res.modPow(b3,modu); System.out.println(res.toString()); } }