import java.io.*; import java.util.*; import java.math.BigInteger; 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 scan = new Scanner(System.in); String line = scan.nextLine(); String[] s = line.split(" ",3); int a = Integer.parseInt(s[0]); int b = Integer.parseInt(s[1]); BigInteger t = new BigInteger(s[2]); double avg = 0.5*(a+b); BigInteger big_avg = new BigInteger(Integer.toString((int)avg)); BigInteger mod = new BigInteger("1000000007"); BigInteger result; result = big_avg.modPow(t,mod); System.out.println(result); } }