from math import gcd a,b,k = map(int, input().split()) c = a*b // gcd(a,b) ng = 0 ok = 10**18 while abs(ok-ng) > 1: m = (ok+ng) // 2 s = m//a+m//b-m//c if s >= k: ok = m else: ng = m print(ok)