#include #include #include #include #include #include #include using namespace std; typedef long long ll; const int MOD=1e9+7; int main() { ll a,b,t,g,ans=1; cin >> t >> a >> b; g=__gcd(a,b); ans+=(t-1)/a+(t-1)/b; unsigned long long l=a/g*b; ans-=(t-1)/l; cout << ans << endl; }