#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n, a, b, c; if (!(cin >> n >> a >> b >> c)) return 0;
    vector<int> dp(n + 1, -1); dp[0] = 0;
    for (int s = 1; s <= n; ++s)
        for (int w : {a, b, c})
            if (s >= w && dp[s - w] >= 0)
                dp[s] = max(dp[s], dp[s - w] + 1);
    cout << dp[n] << '\n';
}
