import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; 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()); BigInteger m = new BigInteger("1000000007"); BigInteger two = new BigInteger("2"); BigInteger result = a.add(b).divide(two).modPow(t, m); System.out.print(result.toString()); } }