#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i) #define all(a) (a).begin(),(a).end() int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); ll A, B, K; cin >> A >> B >> K; ll L = lcm(A, B); ll ng = 0, ok = 1ll << 62; while (ok - ng > 1) { ll mid = (ok - ng) / 2 + ng; ll cnt = (mid / A) + (mid / B) - (mid / L); if (cnt >= K) ok = mid; else ng = mid; } cout << ok << '\n'; }