using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Code { class Program { static void Main(string[] args) { string line = Console.ReadLine(); string[] values = line.Split(' '); long A = long.Parse(values[0]); long B = long.Parse(values[1]); long C = long.Parse(values[2]); //M年ごとにA+B-1円 long turn = C / (A + B - 1); long ans; if ((turn + 1) * (A + B - 1) - B < C) ans = (turn + 1) * A; //Aの倍数時に突破するとき else ans = turn * (1 - B) + C; Console.WriteLine(ans); } } }