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); BigInteger a = new BigInteger(in.next()); BigInteger b = new BigInteger(in.next()); BigInteger t = new BigInteger(in.next()); System.out.println(a.add(b).divide(BigInteger.valueOf(2)).modPow(t, BigInteger.valueOf(1000000007))); } }