import java.io.*; import java.util.*; import java.math.BigInteger; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); int b = in.nextInt(); long t = in.nextLong(); System.out.println(BigInteger.valueOf((a + b) / 2) .modPow(BigInteger.valueOf(t), BigInteger.valueOf(1000000007))); } }