/* -*- coding: utf-8 -*- * * 894.cc: No.894 二種類のバス - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ /* typedef */ typedef long long ll; /* global variables */ /* subroutines */ template T gcd(T m, T n) { // m > 0, n > 0 if (m < n) swap(m, n); while (n > 0) { T r = m % n; m = n; n = r; } return m; } /* main */ int main() { ll t, a, b; scanf("%lld%lld%lld", &t, &a, &b); ll g = gcd(a, b); __int128 l = (__int128)a * b / g; ll c = (t + a - 1) / a + (t + b - 1) / b - (t + l - 1) / l; printf("%lld\n", c); return 0; }