#pragma GCC optimize ("Ofast") #include using namespace std; inline void rd(long long &x){ int k; int m=0; x=0; for(;;){ k = getchar_unlocked(); if(k=='-'){ m=1; break; } if('0'<=k&&k<='9'){ x=k-'0'; break; } } for(;;){ k = getchar_unlocked(); if(k<'0'||k>'9'){ break; } x=x*10+k-'0'; } if(m){ x=-x; } } inline void wt_L(char a){ putchar_unlocked(a); } inline void wt_L(int x){ int s=0; int m=0; char f[10]; if(x<0){ m=1; x=-x; } while(x){ f[s++]=x%10; x/=10; } if(!s){ f[s++]=0; } if(m){ putchar_unlocked('-'); } while(s--){ putchar_unlocked(f[s]+'0'); } } inline void wt_L(unsigned x){ int s=0; char f[10]; while(x){ f[s++]=x%10; x/=10; } if(!s){ f[s++]=0; } while(s--){ putchar_unlocked(f[s]+'0'); } } inline void wt_L(long long x){ int s=0; int m=0; char f[20]; if(x<0){ m=1; x=-x; } while(x){ f[s++]=x%10; x/=10; } if(!s){ f[s++]=0; } if(m){ putchar_unlocked('-'); } while(s--){ putchar_unlocked(f[s]+'0'); } } inline void wt_L(unsigned long long x){ int s=0; char f[21]; while(x){ f[s++]=x%10; x/=10; } if(!s){ f[s++]=0; } while(s--){ putchar_unlocked(f[s]+'0'); } } inline void wt_L(double x){ printf("%.15f",x); } inline void wt_L(const char c[]){ int i=0; for(i=0;c[i]!='\0';i++){ putchar_unlocked(c[i]); } } inline void wt_L(string &x){ int i=0; for(i=0;x[i]!='\0';i++){ putchar_unlocked(x[i]); } } template inline T GCD_L(T a,T b){ T r; while(a){ r=b; b=a; a=r%a; } return b; } long long T; long long A ; long long B; int main(){ rd(T);T += (-1); rd(A); rd(B); wt_L(T / A + T / B - T / A / (B/GCD_L(A, B)) + 1); wt_L('\n'); return 0; } // cLay varsion 20190925-1 // --- original code --- // ll T, A ,B; // { // rd(T--,A,B); // wt(T / A + T / B - T / A / (B/gcd(A,B)) + 1); // }