import java.io.*; import java.util.*; import java.math.*; 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(); int r = (a+b)/2; BigInteger time = new BigInteger(t); BigInteger v = new BigInteger(Integer.toString(r)); BigInteger m = new BigInteger("1000000007"); v = v.modPow(time, m); System.out.println(v); } }