using System; using System.Collections.Generic; using System.IO; using System.Numerics; class Solution { static void Main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */ string inputLine = Console.ReadLine(); string[] inputLineStringArray = inputLine.Split(' '); int a = Convert.ToInt32(inputLineStringArray[0]); int b = Convert.ToInt32(inputLineStringArray[1]); long t = Convert.ToInt64(inputLineStringArray[2]); decimal growthProbability = 0.5M; BigInteger value = (BigInteger)(((decimal)a * growthProbability) + ((decimal)b * growthProbability)); BigInteger result = BigInteger.ModPow(value, (BigInteger)t, (BigInteger)1000000007); Console.WriteLine(result); } }