import java.io.*; import java.util.*; import java.math.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); BigInteger a = sc.nextBigInteger(); BigInteger b = sc.nextBigInteger(); BigInteger t = sc.nextBigInteger(); BigInteger two = new BigInteger("2"); BigInteger x = a.add(b).divide(two); BigInteger p = new BigInteger("1000000007"); BigInteger ans = x.modPow(t,p); System.out.println(ans); } }