#include <bits/stdc++.h>
using namespace std;
int l[8005], b, c, a, n, g, i;
int main() {
  cin >> n >> a >> b >> c;
  l[a] = l[b] = l[c] = 1;
  for (i = 1; i < n; i++) {
    if (l[i] > 0) {
      if (l[i] + 1 > l[a + i]) l[i + a] = l[i] + 1;
      if (l[i] + 1 > l[b + i]) l[i + b] = l[i] + 1;
      if (l[i] + 1 > l[c + i]) l[i + c] = l[i] + 1;
    }
  }
  cout << l[n];
}
