using System; using System.Collections.Generic; using System.IO; class Solution { static void Main(String[] args) { var a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); var ms = a[2]; var f1 = a[0]; var f2 = a[1]; double res = 0; double cells = 1L; for (var i = 1; i <= ms; i++) { cells = ((0.5f * f1 * cells) + (0.5f * f2 * cells)); res += cells % 1000000007; } Console.WriteLine(res); } }