import java.util.*; import java.lang.Math.*; import java.math.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); long t = sc.nextLong(); BigDecimal term1 = (BigDecimal.valueOf(0.5)).multiply((BigDecimal.valueOf(a)).add(BigDecimal.valueOf(b))); BigInteger term2 = (term1.toBigInteger()).modPow(BigInteger.valueOf(t),BigInteger.valueOf(1000000007)); //term1 = term1.pow(t); //BigInteger term2 = (term1.toBigInteger()).mod(BigInteger.valueOf(1000000007)); System.out.print(term2); } }