#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<long long> v(n + 1, -10000000000000);
  v[0] = 0;
  for (long long i = 1; i <= n; i++) {
    if (i >= a) v[i] = max(v[i], v[i - a] + 1);
    if (i >= b) v[i] = max(v[i], v[i - b] + 1);
    if (i >= c) v[i] = max(v[i], v[i - c] + 1);
  }
  cout << v[n];
}
