#include using namespace std; typedef long long ll; long long gcd(long long a, long long b){ if(b==0) return a; return gcd(b,a%b); } bool isprime(long long int val) { if (val <= 1)return false; for (long long int i = 2; i*i <= val; i++) { if (val%i == 0LL)return false; } return true; } signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20); ll t,a,b; cin>>t>>a>>b; t--; ll g = gcd(a,b); if(isprime(a) && isprime(b) && a>1e9 && b>1e9){ cout << t/a + t/b + 1 << endl; } ll l = a/g * b; ll ans = t/a + t/b -t/l; ans++; cout << ans << endl; }