using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace foryuki { class Program { static void Main(string[] args) { string[] s = Console.ReadLine().Split(); long A = long.Parse(s[0]); long B = long.Parse(s[1]); long T = long.Parse(s[2]); var d = long.MaxValue; long x = 0; long y = 0; while (x < T) { y = x; while (y < T) { y += A; } if (y < d) { d = y; } x += B; } if (x < d) { d = x; } Console.WriteLine(d); } //------------------------------------------------------------- static int[] ConvertStringArrayToIntArray(string[] array) { return Array.ConvertAll(array, str => int.Parse(str)); } static List ConvertStringArrayToIntList(string[] str) { var list = new List(); foreach (var c in str) list.Add(int.Parse(c)); return list; } } }