import java.io.*; import java.util.*; import java.math.*; public class Solution { public static void main(String[] args) { Scanner s = new Scanner(System.in); BigInteger a = s.nextBigInteger(); BigInteger b = s.nextBigInteger(); BigInteger t = s.nextBigInteger(); BigInteger result = a.add(b).divide(BigInteger.valueOf(2)).modPow(t, BigInteger.TEN.pow(9).add(BigInteger.valueOf(7L))); System.out.println(result); } }