#include <bits/stdc++.h>
using namespace std;
int ar[5005];
int l;
int cut(int n, int a, int b, int c) {
  if (n == 0)
    return 0;
  else if (n < 0)
    return INT_MIN;
  if (ar[n] == 0)
    ar[n] = 1 + max(cut(n - a, a, b, c),
                    max(cut(n - b, a, b, c), cut(n - c, a, b, c)));
  return ar[n];
}
int main() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  cout << cut(n, a, b, c);
}
