#include #include using namespace std; typedef long long ll; ll gcd(ll a,ll b); int main(void){ ll t,a,b,ans; cin >> t >> a >> b; ans=(t-1)/a+(t-1)/b-(t-1)/(a*b)*gcd(a,b); cout << ans << endl; return 0; } ll gcd(ll a,ll b){ if (a>b) swap(a,b); if (a==0) return b; return gcd(b%a,a); }