#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,ans=0,g,l; cin >> t >> a >> b; ans+=(t-1)/a+1; ans+=(t-1)/b+1; g=__gcd(a,b); l=a/g*b; ans-=(t-1)/l+1; cout << ans << endl; }