a, b, k = gets.chomp.split(" ").map(&:to_i) INF = Float::INFINITY left = -1 right = 10**18 lcm = a.lcm(b) while right - left > 1 mid = (left + right) / 2 point = mid+1 ans = (point / a) + (point / b) - (point/lcm) if ans >= k right = mid else left = mid end end puts right + 1