#include <bits/stdc++.h>
using namespace std;
const int N = (int)(1e5 + 5);
int n, a, b, c;
int d[5000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cin >> n >> a >> b >> c;
  memset(d, -1, sizeof(d));
  d[0] = 0;
  for (int i = 1; i <= n; i++) {
    if (i >= a && d[i - a] >= 0) d[i] = max(d[i], d[i - a] + 1);
    if (i >= b && d[i - b] >= 0) d[i] = max(d[i], d[i - b] + 1);
    if (i >= c && d[i - c] >= 0) d[i] = max(d[i], d[i - c] + 1);
  }
  cout << d[n] << endl;
  return 0;
}
