import math a, b, k = map(int, input().split()) c = math.lcm(a, b) l = 0 r = 10**18 while r - l > 1: m = (l + r) // 2 if m//a + m//b - m//c >= k: r = m else: l = m print(r)