#include using namespace std; #define ll long long #define rep(i, n) for (int i = 0; i < (n); i++) #define P pair #define LP pair const ll INF = 1e18; int main() { ll t, a, b; cin >> t >> a >> b; ll ans = (t-1)/a+(t-1)/b+2; ll g = gcd(a,b); if (a/g < INF/b) { ll l = a/g*b; ans -= (t-1)/l+1; } else { ans--; } cout << ans << endl; return 0; }