import java.io.*; import java.util.*; import java.math.BigInteger; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner reader = new Scanner(System.in); // Reading from System.in BigInteger a = reader.nextBigInteger(); // Scans the next token of the input as an int. BigInteger b = reader.nextBigInteger(); // Scans the next token of the input as an int. BigInteger ms = reader.nextBigInteger(); // Scans the next token of the input as an int. BigInteger mod = BigInteger.valueOf(1000000007); System.out.println(a.add(b).divide(BigInteger.valueOf(2)).modPow(ms, mod) ) ; } }