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. */ /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ int a, b; int opera; long t; BigInteger result1; BigInteger result2; Scanner scan = new Scanner(System.in); a = scan.nextInt(); b = scan.nextInt(); t = scan.nextLong(); opera = (int)(0.5*(a+b)); result1 = BigInteger.valueOf(opera); result2 = result1.modPow(BigInteger.valueOf(t),BigInteger.valueOf(1000000007)); System.out.println(result2); } }