#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { ll n, a, b, c; cin >> n >> a >> b >> c; ll ans = 0; ans += n / a; ans += n / b; ans += n / c; ans -= n / lcm(a, b); ans -= n / lcm(b, c); ans -= n / lcm(c, a); ans += n / lcm(a, lcm(b, c)); cout << ans << endl; return 0; }