import java.io.*; import java.util.*; import java.math.*; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int a = scan.nextInt(); int b = scan.nextInt(); String t = scan.next(); BigInteger time = new BigInteger(t); int growth = (a + b) / 2; BigInteger bigGrowth = new BigInteger(Integer.toString(growth)); BigInteger mod = new BigInteger("1000000007"); BigInteger result = bigGrowth.modPow(time,mod); System.out.println(result.toString()); } }