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 scan = new Scanner(System.in); int a = scan.nextInt(); int b = scan.nextInt(); String t = scan.next(); BigInteger ans; int ave = (a+b) / 2; String average = Integer.toString(ave); BigInteger exponent = new BigInteger(t); BigInteger base = new BigInteger(average); BigInteger mod = new BigInteger("1000000007"); ans = base.modPow(exponent, mod); System.out.println(ans); } }