#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, x, j, k, p, ans, m, l = 0;
  cin >> n;
  vector<int> a;
  for (int h = 0; h < 3; h++) {
    cin >> x;
    a.push_back(x);
  }
  sort(a.rbegin(), a.rend());
  for (i = 0, k = 0; i <= n; i += a[0], k++) {
    for (j = 0, p = 0; j <= n; p++, j += a[1]) {
      if ((n - i - j) % a[2] == 0) {
        ans = (n - i - j) / a[2];
        m = p + k + ans;
        if (m > l) l = m;
      }
    }
  }
  cout << l << endl;
  return 0;
}
