import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; public class Solution { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] split = br.readLine().split(" "); long a = Long.valueOf(split[0]); long b = Long.valueOf(split[1]); long t = Long.valueOf(split[2]); System.out.println(BigInteger.valueOf((a + b) / 2) .modPow(BigInteger.valueOf(t), BigInteger.valueOf(1000000007L)).toString()); } }