using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (a, b, k) = (c[0], c[1], c[2]); var lcm = (long)a / GCD(a, b) * b; var ok = 1_100_000_000_000_000_000; var ng = 0L; while (ok - ng > 1) { var mid = (ok + ng) / 2; if (mid / a + mid / b - mid / lcm >= k) ok = mid; else ng = mid; } WriteLine(ok); } static int GCD(int a, int b) { if (a < b) return GCD(b, a); if (a % b == 0) return b; return GCD(b, a % b); } }