import java.io.*; import java.util.*; import java.math.BigInteger; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner scn=new Scanner(System.in); String a=scn.next(); String b=scn.next(); String t=scn.next(); BigInteger tb=new BigInteger(t); BigInteger ab=new BigInteger(a); BigInteger bb=new BigInteger(b); BigInteger bsum=ab.add(bb); bsum=bsum.divide(new BigInteger("2")); int modv=(int)(Math.pow(10,9))+7; BigInteger bc=BigInteger.valueOf(modv); bsum=bsum.modPow(tb,bc); System.out.print(bsum.mod(BigInteger.valueOf(modv))); } }