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 scanner = new Scanner(System.in); int a = scanner.nextInt(); int b = scanner.nextInt(); long t = scanner.nextLong(); scanner.close(); BigInteger modulo = BigInteger.valueOf(1000000007); BigInteger base = BigInteger.valueOf((long)(0.5 * a + 0.5 * b)); BigInteger expectedNumber = base.modPow(BigInteger.valueOf(t), modulo); System.out.println(expectedNumber.intValue()); } }