#include <bits/stdc++.h>
using namespace std;
const int maxn = 4000 + 5;
int n, a, b, c, d[maxn];
int main() {
  int x1, x2, x3;
  cin >> n >> a >> b >> c;
  d[0] = 0;
  for (int i = 1; i <= n; i++) {
    if ((i > a && d[i - a] == -1) || i < a)
      x1 = -1;
    else
      x1 = d[i - a] + 1;
    if ((i > b && d[i - b] == -1) || i < b)
      x2 = -1;
    else
      x2 = d[i - b] + 1;
    if ((i > c && d[i - c] == -1) || i < c)
      x3 = -1;
    else
      x3 = d[i - c] + 1;
    d[i] = max(max(x1, x2), x3);
  }
  cout << d[n] << endl;
  return 0;
}
