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) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner sc = new Scanner(System.in); BigInteger a = new BigInteger(sc.next()); BigInteger b = new BigInteger(sc.next()); BigInteger t = new BigInteger(sc.next()); BigInteger power = new BigInteger("1000000007"); BigInteger two = new BigInteger("2"); BigInteger ans = b.add(a); ans = ans.divide(two); ans = ans.modPow(t,power); System.out.print(ans); } }