#include #define rep(i,n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair; struct fast_ios { fast_ios(){ cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(20); }; } fast_ios_; const int INF = (int)1e9; const ll INFL = (ll)1e18; const int MOD = 1e9 + 7; const double EPS = 1e-10; int dx[]={0, 0, -1, 1}; int dy[]={1, -1, 0, 0}; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } int main() { ll n, a, b, c; cin >> n >> a >> b >> c; ll ans = 0; ans += n / a; ans += n / b; ans += n / c; ll lcm1 = lcm(a, b); ll lcm2 = lcm(a, c); ll lcm3 = lcm(b, c); ll lcm4 = lcm(lcm1, c); ans -= n / lcm1; ans -= n / lcm2; ans -= n / lcm3; ans += n / lcm4; cout << ans << endl; return 0; }