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 scan = new Scanner(System.in); int factora = scan.nextInt(); int factorb = scan.nextInt(); int millis = scan.nextInt(); double initialTransformation = (0.5*factora) + (0.5*factorb); int result = (int) (Math.pow(initialTransformation, millis) % (Math.pow(10, 9) + 7)); System.out.println(result); } }