using static System.Math; using System; public class Hello { public static long a, b, k; static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); a = long.Parse(line[0]); b = long.Parse(line[1]); k = long.Parse(line[2]); getAns(); } static bool check(long t) => t / a + t / b - t / a / b >= k; static void getAns() { if (k == 1) { Console.WriteLine(Min(a, b)); return; } if (k == 2) { Console.WriteLine(Max(a, b)); return; } var ok = long.MaxValue; var ng = 1L; while (ok - ng > 1) { var mid = ng + (ok - ng) / 2L; if (check(mid)) ok = mid; else ng = mid; } Console.WriteLine(ok); } }