// ?????? ????? ??????????? ??????????? #include #include #include using namespace __gnu_pbds; using namespace std; typedef tree, rb_tree_tag, tree_order_statistics_node_update> indexed_set; #define pb push_back #define all(x) x.begin(), x.end() #define int long long #define py cout << "YES\n"; #define pn cout << "NO\n"; #define forn(a, b) for (int i = a; i < b; i++) #define nl cout << endl; #define pii pair typedef long long ll; typedef vector vi; typedef vector vii; const int mod = 1e9 + 7; void solve(); signed main(void) { ios::sync_with_stdio(false); cin.tie(nullptr); int tc = 1; while (tc--) solve(); return 0; } void solve() { int n, a, b, c; cin >> n >> a >> b >> c; set st; int count = 0; int i = 0; while (a * ++i <= n) { int number = a * i; if (st.find(number) != st.end()) continue; st.insert(number); count++; } i = 0; while (b * ++i <= n) { int number = b * i; if (st.find(number) != st.end()) continue; st.insert(number); count++; } i = 0; while (c * ++i <= n) { int number = c * i; if (st.find(number) != st.end()) continue; st.insert(number); count++; } cout << count; }