#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll=long long; template using V = vector; template using P = pair; using vll = V; using vvll = V; #define rep(i, k, n) for (ll i=k; i<(ll)n; ++i) #define REP(i, n) rep(i, 0, n) #define ALL(v) v.begin(),v.end() template inline bool chmax(T& a, T b) {if (a inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;} const ll MOD = 1000000007; const ll HIGHINF = (ll)1e18; ll gcd(ll a, ll b) { if (b==0) return a; else return gcd(b, a%b); } int main() { cin.tie(0); ios::sync_with_stdio(false); ll t, a, b; cin >> t >> a >> b; ll ans = (t-1)/a + (t-1)/b; ll abg = gcd(a, b); ll abl = abg * a/abg * b/abg; cout << ans - (t-1)/abl + 1 << '\n'; return 0; }