#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;

ll gcd;

bool overflow(ll a, ll b){
    ll M = 1e18;
    if(a < b) swap(a, b);
    b /= gcd;
    string s = to_string(a);
    bool over = false;
    rep(i, s.size()-1){
        ll x = stoll(s.substr(0, i+1));
        if(x * b > M){
            over = true;
            break;
        }
    }
    
    return over;
}

int main(){
    ll t, a, b;
    cin >> t >> a >> b;
    gcd = __gcd(a, b);
    bool ok = !overflow(a, b);
    ll lcm;
    if(ok) lcm = a / gcd * b;
    ll ans = 1 + t/a + t/b - (t%a==0) - (t%b==0);

    if(ok) ans += -t/lcm + (t%lcm == 0);

    cout << ans << endl;
}