#include #include using namespace std;using namespace atcoder; using ll=long long;using vl=vector; using vi=vector;using vs=vector;using vc=vector; using vvl=vector;using pl=pair;using vvc=vector; using vd=vector;using vpl=vector;using vb=vector; #define fi first #define se second #define rep(i,r) for(ll i=0;i<(r);i++) #define Rep(i,l,r) for(ll i=(l);i<(r);i++) #define print(n) cout<<(n)<> void yn(bool b){print(b?"Yes":"No");exit(0);} ll gcd(ll a,ll b) {if(b==0)return a;else return gcd(b,a%b);} ll lcm(ll a,ll b){return a/gcd(a,b)*b;} ll modpow(ll a,ll n,ll mod) {ll res=1;while(n>0) {if(n&1)res=res*a%mod;a=a*a%mod;n >>= 1;}return res;} ll modinv(ll a,ll mod){return modpow(a, mod - 2, mod);} ll p=0,q=0,r=0,inf=100000000000000,mod=1000000007; ll dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1}; //ここから本質←ほんまか? int main() { ll a,b,k; cin>>a>>b>>k; ll ok=a*k,ng=0; while(abs(ok-ng)>1) { ll mid=(ok+ng)/2; if(mid/a+mid/b-mid/lcm(a,b)