#include long long int gcd(long long int a, long long int b) { long long int r = a % b; while (r > 0) { a = b; b = r; r = a % b; } return b; } int main() { long long int a, b, k; scanf("%lld %lld %lld", &a, &b, &k); long long int l = a / gcd(a, b) * b; long long int min, mid, max; min = -1; max = 2e18; while (max - min > 1) { mid = (max + min) / 2; if (mid / a + mid / b - mid / l < k) min = mid; else max = mid; } printf("%lld\n", max); return 0; }