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(); BigInteger t = new BigInteger(in.next()); BigInteger virusPop; BigInteger scale = BigInteger.valueOf(10) .pow(9).add(BigInteger.valueOf(7)); virusPop = BigInteger.valueOf((a+b)/2).modPow(t, scale); System.out.println(virusPop.mod(scale)); } }