import java.io.*; import java.util.*; import java.math.*; public class Solution { public static void main(String[] args) { Scanner s = new Scanner(System.in); int a =s.nextInt(); int b = s.nextInt(); BigInteger T=new BigInteger(s.nextLine().trim()) ; BigInteger actualCells=null; actualCells=BigInteger.valueOf((a+b)/2).modPow(T, BigInteger.valueOf(1000000007)); System.out.println(actualCells); } }