#include using namespace std; // Define using ll = long long; using ull = unsigned long long; using ld = long double; const ll dx[4] = {1, 0, -1, 0}; const ll dy[4] = {0, 1, 0, -1}; const ll MOD = 1e9 + 7; const ll mod = 998244353; const ll inf = 1 << 30; const ll LINF = LONG_MAX; const ll INF = 1LL << 60; const ull MAX = ULONG_MAX; #define mp make_pair #define pb push_back #define elif else if #define endl '\n' #define space ' ' #define def inline auto #define func inline constexpr ll #define run(a) __attribute__((constructor)) def _##a() #define all(v) begin(v), end(v) #define rall(v) rbegin(v), rend(v) #define input(a) scanf("%lld", &(a)) #define print(a) printf("%lld\n", (a)) #define fi first #define se second #define ok(a, b) (0 <= (a) && (a) < (b)) template using vvector = vector>; template using pvector = vector>; template using rpriority_queue = priority_queue, greater>; template bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; } // Debug #define debug(...) \ { \ cerr << __LINE__ << ": " << #__VA_ARGS__ << " = "; \ for (auto &&X : {__VA_ARGS__}) cerr << "[" << X << "] "; \ cerr << endl; \ } #define dump(a, h, w) \ { \ cerr << __LINE__ << ": " << #a << " = [" << endl; \ rep(__i, h) { \ rep(__j, w) { cerr << a[__i][__j] << space; } \ cerr << endl; \ } \ cerr << "]" << endl; \ } #define vdump(a, n) \ { \ cerr << __LINE__ << ": " << #a << " = ["; \ rep(__i, n) if (__i) cerr << space << a[__i]; \ else cerr << a[__i]; \ cerr << "]" << endl; \ } // Loop #define inc(i, a, n) for (ll i = (a), _##i = (n); i <= _##i; ++i) #define dec(i, a, n) for (ll i = (a), _##i = (n); i >= _##i; --i) #define rep(i, n) for (ll i = 0, _##i = (n); i < _##i; ++i) #define each(i, a) for (auto &&i : a) #define loop() for (;;) // Stream #define fout(n) cout << fixed << setprecision(n) #define fasten cin.tie(0), ios::sync_with_stdio(0) run(0) { fasten, fout(10); } // Speed #pragma GCC optimize("O3") #pragma GCC target("avx") // Math func gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } func lcm(ll a, ll b) { return a * b / gcd(a, b); } func sign(ll a) { return a ? abs(a) / a : 0; } inline constexpr ll modulo(const ll n, const ll m = MOD) { ll k = n % m; return k + m * (k < 0); } inline constexpr ll chmod(ll &n, const ll m = MOD) { n %= m; return n += m * (n < 0); } inline constexpr ll mpow(ll a, ll n, const ll m = MOD) { ll r = 1; while (n) { if (n & 1) r *= a; chmod(r, m); a *= a; chmod(a, m); n >>= 1; } return r; } inline ll inv(const ll n, const ll m = MOD) { ll a = n, b = m, x = 1, y = 0; while (b) { ll t = a / b; a -= t * b; swap(a, b); x -= t * y; swap(x, y); } return modulo(x, m); } struct Factor { inline vector factors(ll N) { vector A; ll i = 2; while (i * i <= N) { if (N % i == 0) { A.push_back(i); N /= i; } else { i++; } } if (N != 1) A.push_back(N); sort(all(A)); return A; } inline vector divisor(ll N) { vector A; inc(i, 1, sqrt(N)) { if (N % i == 0) { A.push_back(i); if (i * i != N) A.push_back(N / i); } } sort(all(A)); return A; } }; struct csum { ll N; vector A, S; csum(vector v) : A(v), S(1) { each(k, v) S.push_back(k + S.back()); } ll sum(ll l, ll r) { return S[r] - S[l]; } ll lsum(ll r) { return S[r]; } ll rsum(ll l) { return S.back() - S[l]; } }; template struct mi { inline constexpr ll modulo(const ll n, const ll m) const noexcept { ll k = n % m; return k + m * (k < 0); } ll num; inline constexpr mi() noexcept : num() { num = 0; } inline constexpr mi(const int n) noexcept : num() { num = modulo(n, mod); } inline constexpr mi(const ll n) noexcept : num() { num = modulo(n, mod); } inline constexpr mi inv() const noexcept { ll a = num, b = mod, x = 1, y = 0; while (b) { ll t = a / b; a -= t * b; swap(a, b); x -= t * y; swap(x, y); } return mi(x); } inline constexpr mi inv(ll n) const noexcept { ll a = n, b = mod, x = 1, y = 0; while (b) { ll t = a / b; a -= t * b; swap(a, b); x -= t * y; swap(x, y); } return mi(x); } inline constexpr mi inv(const mi m) const noexcept { return inv(m.num); } inline constexpr mi operator+() const noexcept { return mi(num); } inline constexpr mi operator+(const int n) const noexcept { return mi(num + n); } inline constexpr mi operator+(const ll n) const noexcept { return mi(num + n); } inline constexpr mi operator+(const mi m) const noexcept { return mi(num + m.num); } inline constexpr mi operator-() const noexcept { return -num; } inline constexpr mi operator-(const int n) const noexcept { return mi(num - n); } inline constexpr mi operator-(const ll n) const noexcept { return mi(num - n); } inline constexpr mi operator-(const mi m) const noexcept { return mi(num - m.num); } inline constexpr mi operator*(const int n) const noexcept { return mi(num * n); } inline constexpr mi operator*(const ll n) const noexcept { return mi(num * n); } inline constexpr mi operator*(const mi m) const noexcept { return mi(num * m); } inline constexpr mi operator/(const int n) const noexcept { return mi(num * (ll) inv(n)); } inline constexpr mi operator/(const ll n) const noexcept { return mi(num * (ll) inv(n)); } inline constexpr mi operator/(const mi m) const noexcept { return mi(num * (ll) inv(m)); } inline constexpr mi &operator=(const int n) noexcept { num = modulo(n, mod); return *this; } inline constexpr mi &operator=(const ll n) noexcept { num = modulo(n, mod); return *this; } inline constexpr mi &operator=(const mi m) noexcept { num = m.num; return *this; } inline constexpr mi &operator+=(const int n) noexcept { num = modulo(num + n, mod); return *this; } inline constexpr mi &operator+=(const ll n) noexcept { num = modulo(num + n, mod); return *this; } inline constexpr mi &operator+=(const mi m) noexcept { num = modulo(num + m.num, mod); return *this; } inline constexpr mi &operator++() noexcept { num = modulo(num + 1, mod); return *this; } inline constexpr mi operator++(int) noexcept { mi &pre = *this; num = modulo(num + 1, mod); return pre; } inline constexpr mi &operator-=(const int n) noexcept { num = modulo(num - n, mod); return *this; } inline constexpr mi &operator-=(const ll n) noexcept { num = modulo(num - n, mod); return *this; } inline constexpr mi &operator-=(const mi m) noexcept { num = modulo(num - m.num, mod); return *this; } inline constexpr mi &operator--() noexcept { num = modulo(num - 1, mod); return *this; } inline constexpr mi operator--(int) noexcept { mi &pre = *this; num = modulo(num - 1, mod); return pre; } inline constexpr mi &operator*=(const int n) noexcept { num = modulo(num * n, mod); return *this; } inline constexpr mi &operator*=(const ll n) noexcept { num = modulo(num * n, mod); return *this; } inline constexpr mi &operator*=(const mi m) noexcept { num = modulo(num * m.num, mod); return *this; } inline constexpr mi &operator/=(const int n) noexcept { num = modulo(num * (ll) inv(n), mod); return *this; } inline constexpr mi &operator/=(const ll n) noexcept { num = modulo(num * (ll) inv(n), mod); return *this; } inline constexpr mi &operator/=(const mi m) noexcept { num = modulo(num * (ll) inv(m), mod); return *this; } inline constexpr mi operator==(const int n) const noexcept { return num == modulo(n, mod); } inline constexpr mi operator==(const ll n) const noexcept { return num == modulo(n, mod); } inline constexpr mi operator==(const mi m) const noexcept { return num == m.num; } inline constexpr mi operator!=(const int n) const noexcept { return num != modulo(n, mod); } inline constexpr mi operator!=(const ll n) const noexcept { return num != modulo(n, mod); } inline constexpr mi operator!=(const mi m) const noexcept { return num != m.num; } constexpr operator int() const noexcept { return num; } constexpr operator ll() const noexcept { return num; } friend std::istream &operator>>(std::istream &, const mi<> &); friend std::ostream &operator<<(std::ostream &, const mi<> &); }; template inline constexpr mi operator+(const int n, const mi m) noexcept { return mi(n + m.num); } template inline constexpr mi operator+(const ll n, const mi m) noexcept { return mi(n + m.num); } template inline constexpr mi operator-(const int n, const mi m) noexcept { return mi(n - m.num); } template inline constexpr mi operator-(const ll n, const mi m) noexcept { return mi(n - m.num); } template inline constexpr mi operator*(const int n, const mi m) noexcept { return mi(n * m.num); } template inline constexpr mi operator*(const ll n, const mi m) noexcept { return mi(n * m.num); } template inline constexpr mi operator/(const int n, const mi m) noexcept { return mi(n * (ll) m.inv()); } template inline constexpr mi operator/(const ll n, const mi m) noexcept { return mi(n * (ll) m.inv()); } inline constexpr mi operator""_m(ull n) { return mi((ll) n); } template inline constexpr mi pow(mi m, ll n) noexcept { mi r = mi(1); while (n) { if (n & 1) r *= m; m *= m; n >>= 1; } return r; } template istream &operator>>(istream &is, mi &m) { is >> m.num; return is; } template ostream &operator<<(ostream &is, mi &m) { is << (ll) m; return is; } template struct modmath { ll max; vector> fac, inv; modmath() : max(1 << 20), fac(max + 1), inv(max + 1) { fac[0] = mi(1); rep(i, max) fac[i + 1] = fac[i] * (i + 1); inv[max] = fac[max].inv(); dec(i, max - 1, 0) inv[i] = inv[i + 1] * (i + 1); } modmath(ll n) : max(n), fac(n + 1), inv(n + 1) { fac[0] = 1; rep(i, n) fac[i + 1] = fac[i] * (i + 1); inv[n] = 1 / fac[n]; dec(i, n - 1, 0) inv[i] = inv[i + 1] * (i + 1); } inline mi fact(ll n) { if (n < 0) return mi(0); return fac[n]; } inline mi perm(ll n, ll r) { if (r < 0 || n < r) return mi(0); return fac[n] * inv[n - r]; } inline mi comb(ll n, ll r) { if (r < 0 || n < r) return mi(0); return fac[n] * inv[r] * inv[n - r]; } inline mi nHr(ll n, ll r) { return comb(n + r - 1, n - 1); } }; struct UFR { vector data; UFR(ll N) : data(N) { rep(i, N) data[i] = -1; } def root(ll x) { if (data[x] < 0) return x; else return data[x] = root(data[x]); } def unite(ll x, ll y) { ll root_x = root(x), root_y = root(y); if (root_x != root_y) { if (data[root_x] > data[root_y]) swap(root_x, root_y); data[root_x] -= data[root_x] == data[root_y]; data[root_y] = root_x; return true; } return false; } def same(ll x, ll y) { return root(x) == root(y); } }; struct position { ll x, y; position() {} position(ll a, ll b) : x(a), y(b) {} position next(ll i) { return {x + dx[i], y + dy[i]}; } ll mdist() { return abs(x) + abs(y); } double dist() { return sqrt(x * x + y * y); } double norm(ll d) { if (d == inf) return max(x, y); if (d == 1) return mdist(); if (d == 2) return dist(); return 0; } ll num(ll width) { return abs(x) * width + abs(y); } bool operator==(position a) { return x == a.x && y == a.y; } bool operator!=(position a) { return x != a.x || y != a.y; } bool operator<(position a) { return x < a.x && y < a.y; } bool operator>(position a) { return x > a.x && y > a.y; } bool operator<=(position a) { return x <= a.x && y <= a.y; } bool operator>=(position a) { return x >= a.x && y >= a.y; } position operator+(position a) { return position(x + a.x, y + a.y); } position operator-(position a) { return position(x - a.x, y - a.y); } position operator*(position a) { return position(x * a.x, y * a.y); } position operator/(position a) { return position(x / a.x, y / a.y); } position operator%(position a) { return position(x % a.x, y % a.y); } position complex(position a) { return position(x * a.x - y * a.y, x * a.y + y * a.x); } /* // for sort: bool operator<(position a) { return x ^ a.x ? x < a.x : y < a.y; } bool operator>(position a) { return x ^ a.x ? x > a.x : y > a.y; } bool operator<=(position a) { return x ^ a.x ? x < a.x : y <= a.y; } bool operator>=(position a) { return x ^ a.x ? x > a.x : y >= a.y; } */ }; position Origin = position(0, 0); using pos = position; using vec = position; template struct Array { struct node { ll childl, childr; T data; node(ll l, ll r, T t) : childl(l), childr(r), data(t) {} }; ll n, depth; vector versions; vector prev_versions; vector nodes; Array(ll n = 1 << 20, T val = T()) : n(n), depth(0) { while (n /= 2) depth++; init(val); } void init(T val) { versions.push_back(0); prev_versions.push_back(0); rep(i, 2 * n - 1) { if (i < n - 1) { nodes.push_back(node(2 * i + 1, 2 * i + 2, T())); } else { nodes.push_back(node(0, 0, val)); } } } void set(ll index, ll val, ll version = -1) { ll id, par = nodes.size(), left = 0, right = n; if (version == -1) { id = versions.back(); version = versions.size() - 1; } else { id = versions[version]; } versions.push_back(par); prev_versions.push_back(version); if (right == -1) right = n; rep(i, depth) { ll mid = (left + right) / 2; if (index < mid) { nodes.push_back(node(par + i + 1, nodes[id].childr, T())); id = nodes[id].childl; right = mid; } else { nodes.push_back(node(nodes[id].childl, par + i + 1, T())); id = nodes[id].childr; left = mid; } } nodes.push_back(node(0, 0, val)); } T get(ll index, ll version = -1) { ll id, left = 0, right = n; if (version == -1) { id = versions.back(); } else { id = versions[version]; } rep(i, depth) { ll mid = (left + right) / 2; if (index < mid) { id = nodes[id].childl; right = mid; } else { id = nodes[id].childr; left = mid; } } return nodes[id].data; } ll latest() { return versions.size() - 1; } }; struct BipartiteGraph { ll V; vector> G; vector match; vector used; BipartiteGraph(ll N) : V(N), G(N), match(N), used(N) {} void addEdge(ll i, ll j) { G[i].push_back(j); G[j].push_back(i); } bool dfs(ll now) { used[now] = true; rep(i, G[now].size()) { ll next = G[now][i], w = match[next]; if (w == -1 || (!used[w] && dfs(w))) { match[now] = next, match[next] = now; return true; } } return false; } ll matching() { ll res = 0; fill(all(match), -1); rep(i, V) { if (match[i] == -1) { fill(all(used), false); if (dfs(i)) res++; } } return res; } }; signed main() { ll T, A, B; cin >> T >> A >> B; cout << T / A + T / B - T / lcm(A, B) << endl; }