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); long a = in.nextLong(); long b = in.nextLong(); long t = in.nextLong(); BigInteger result; BigInteger modValue = BigInteger.valueOf(7).add(BigInteger.valueOf((long)Math.pow(10, 9))); BigInteger aBig = BigInteger.valueOf(a); BigInteger bBig = BigInteger.valueOf(b); result = aBig.add(bBig).divide(BigInteger.valueOf(2)).modPow(BigInteger.valueOf(t), modValue); System.out.println(result); } }