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) { Scanner stdin = new Scanner(System.in); String[] line = stdin.nextLine().split(" "); int a = Integer.parseInt(line[0]); int b = Integer.parseInt(line[1]); int epochs = Integer.parseInt(line[2]); System.out.println((int)(Math.pow((a + b) / 2, epochs) % 1000000007)); /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ } }