#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
long long F[111111];
long long d, e, f;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  fill(F + 1, F + n + 1, -INF);
  for (int i = 1; i <= n; ++i) {
    d = e = f = -INF;
    if (i >= a) d = F[i - a];
    if (i >= b) e = F[i - b];
    if (i >= c) f = F[i - c];
    F[i] = max(d, max(e, f)) + 1;
  }
  cout << F[n];
  return 0;
}
