#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); } 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(t/a < 1e6 && t/b < 1e6){ set st; st.insert(0); for(ll i=1;a*i<=t;i++){ st.insert(a*i); } for(ll i=1;b*i<=t;i++){ st.insert(b*i); } cout << st.size() << endl; return 0; } ll l = a/g * b; ll ans = t/a + t/b -t/l; ans++; cout << ans << endl; }