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) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner in = new Scanner(System.in); BigInteger a = in.nextBigInteger(); BigInteger b = in.nextBigInteger(); BigInteger t = in.nextBigInteger(); BigInteger two = new BigInteger("2"); BigInteger mod = new BigInteger("1000000007"); if (a.remainder(two) == BigInteger.ZERO) { System.out.println(a.divide(two).add(b.divide(two)).modPow(t, mod)); } else { System.out.println((a.divide(two).add(b.divide(two))).add(BigInteger.ONE).modPow(t, mod)); } } }