#include long long gcd(long long a,long long b){ return b?gcd(b,a%b):a; } int main(){ long long a,b,k; scanf("%lld%lld%lld",&a,&b,&k); long long L = 1, R = 1e18+7; long long res = -1; long long g = a*b/gcd(a,b); while(L<=R){ long long M = (L+R)/2; long long have = M/a+M/b-M/g; if(have>=k){ res = M; R = M-1; } else L = M+1; } printf("%lld\n",res); return 0; }