#include #include #include using lint = long long; void solve() { lint n; std::cin >> n; std::vector xs(3); for (auto& x : xs) std::cin >> x; lint ans = 0; for (int b = 1; b < (1 << 3); ++b) { lint l = 1; for (int i = 0; i < 3; ++i) { if ((b >> i) & 1) l = std::lcm(l, xs[i]); } ans += n / l * (__builtin_popcountll(b) % 2 == 1 ? 1 : -1); } std::cout << ans << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }