import math A, B, K = map(int, input().split()) l = min(A, B) r = max(A, B) * K C = A * B / math.gcd(A, B) while l < r: m = (l+r) // 2 a = m // A b = m // B c = m // C if a + b - c == K: m = max(a * A, b * B) break elif a + b - c < K: l = m else: r = m print(m)