#include #include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define ll long long #define ld long double #define INF 1000000000000000000 typedef pair pll; long long GCD(long long a, long long b) { if (b == 0) return a; else return GCD(b, a % b); } long long LCM(long long a, long long b) { return a / GCD(a, b) * b; } int main() { cin.tie(0); ios::sync_with_stdio(false); ll T, A, B; cin >> T >> A >> B; T--; ll gcd = GCD(A, B), lcm; if ((LLONG_MAX / B) < (A / gcd)) lcm = T + 10; else lcm = LCM(A, B); cout << (T / A + 1) + (T / B + 1) - (T / lcm + 1) << endl; return 0; }