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 a = scan.nextInt(); int b = scan.nextInt(); long t = scan.nextLong(); BigInteger numOfViruses = new BigInteger("1"); int growthFactorInt = (int)(0.5*a + 0.5*b); BigInteger time = new BigInteger(Long.toString(t)); BigInteger growthFactor = new BigInteger(Integer.toString(growthFactorInt)); BigInteger modulo = new BigInteger("1000000007"); numOfViruses = growthFactor.modPow(time, modulo); System.out.println(numOfViruses); } }