#include using namespace std; using ll = long long; int main(void) { ll a, b, k; cin >> a >> b >> k; if (a > b) swap(a, b); auto f = [&](ll x) { ll l = lcm(a, b); ll s = x / a; ll t = x / b; ll u = x / lcm(a, b); return s + t - u; }; ll l = 1, r = 1e18; while (r - l > 1) { ll m = (l + r) / 2; if (f(m) >= k) r = m; else l = m; } cout << r << endl; return 0; }