#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const long long MAX = 510000; const long long INF = 1LL << 60; const long long MOD = 1000000007LL; using namespace std; typedef unsigned long long ull; typedef long long ll; ll gcd(ll x, ll y) { ll r; if (x < y) { swap(x, y); } while (y > 0) { r = x % y; x = y; y = r; } return x; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int main() { ll T, A, B; cin >> T >> A >> B; ll lc = lcm(A, B); ll cnt = 0; if (T % A == 0) { cnt += T / A; } else { cnt += T / A + 1; } if (T %B == 0) { cnt += T / B; } else { cnt += T / B + 1; } if (T % lc == 0) { cnt -= T / lc; } else { cnt -= T / lc + 1; } cout << cnt << endl; return 0; }