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 in = new Scanner(System.in); BigInteger rateA = new BigInteger(in.next()); BigInteger rateB = new BigInteger(in.next()); BigInteger t = new BigInteger(in.next()); BigInteger m = new BigInteger("1000000007"); BigInteger a = ((rateA.add(rateB)).divide(new BigInteger("2"))).modPow(t,m); System.out.println(a); } }