#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) { x = a * x; ll s = x / a; ll t = x / b; ll u = x / (a * b); return s + t - u; }; ll l = 1, r = 1e9; while (r - l > 1) { ll m = (l + r) / 2; if (f(m) <= k) l = m; else r = m; } cout << a * l << endl; return 0; }