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 = new Dictionary(); long x = 0; long y = 0; while (x < T) { y = x; while (y < T) { y += A; } if (!d.ContainsKey(y)) { d.Add(y, y); } x += B; } Console.WriteLine(d.Values.Min()); } //------------------------------------------------------------- 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; } } }