#include <bits/stdc++.h>
using namespace std;
int f[10005];
int main() {
  int n, a[3];
  scanf("%d", &n);
  for (int i = 0; i < 3; i++) scanf("%d", &a[i]);
  int v[3] = {1, 1, 1};
  for (int i = 0; i < 10005; i++) f[i] = -99999999;
  f[0] = 0;
  for (int i = 0; i < 3; i++) {
    for (int j = a[i]; j <= n; j++) {
      f[j] = max(f[j], f[j - a[i]] + v[i]);
    }
  }
  printf("%d\n", f[n]);
  return 0;
}
