using System; using System.Collections.Generic; using System.IO; class Solution { static void Main(String[] args) { string[] input = Console.ReadLine().Split(' '); int a = Convert.ToInt32(input[0]); int b = Convert.ToInt32(input[1]); long t = Convert.ToInt64(input[2]); long l = (long)Math.Pow(10,9)+7; var p = new LongPow(l); long result = p.Pow((a+b)/2, t); Console.WriteLine((int)result); } public abstract class GenericPow { protected readonly long mod; protected GenericPow(long mod = 0) { this.mod = mod; } public T Pow(T value, long power) { T multiplier = value; T result = One(); while (power > 0) { if (power % 2 == 1) { result = Multiply(result, multiplier); if (this.mod > 0) { result = Mod(result); } power -= 1; } multiplier = Multiply(multiplier, multiplier); if (this.mod > 0) { multiplier = Mod(multiplier); } power /= 2; } return result; } public abstract T One(); public abstract T Multiply(T a, T b); public abstract T Mod(T value); } public class LongPow : GenericPow { public LongPow(long mod = 0) : base(mod) { } public override long One() { return 1L; } public override long Multiply(long a, long b) { return a * b; } public override long Mod(long value) { return value %= this.mod; } } public class DoublePow : GenericPow { public DoublePow(long mod = 0) : base(mod) { } public override double One() { return 1D; } public override double Multiply(double a, double b) { return a * b; } public override double Mod(double value) { return value %= this.mod; } } }