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 sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); BigInteger t = sc.nextBigInteger(); sc.close(); Solution sol = new Solution(); BigInteger res = sol.calc(a, b, t); System.out.println(res); } BigInteger calc(int a, int b, BigInteger t){ BigInteger res = BigInteger.valueOf(0); BigInteger a1 = BigInteger.valueOf(a); BigInteger b1 = BigInteger.valueOf(b); BigInteger cons = BigInteger.valueOf(2); BigInteger x = BigInteger.valueOf((long)(Math.pow(10,9) + 7)); res = (a1.add(b1)).divide(cons); res = res.modPow(t, x); return res; } }