#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int N = 100000 + 100;
const int inf = 0x7fffffff;
int n, a, b, c;
int f[N];
int main() {
  scanf("%d%d%d%d", &n, &a, &b, &c);
  for (int i = 1; i <= n; i++) f[i] = -inf;
  f[0] = 0;
  for (int i = min(a, min(b, c)); i <= n; i++) {
    if (i >= a && f[i - a] != inf) f[i] = max(f[i], f[i - a] + 1);
    if (i >= b && f[i - b] != inf) f[i] = max(f[i], f[i - b] + 1);
    if (i >= c && f[i - c] != inf) f[i] = max(f[i], f[i - c] + 1);
  }
  printf("%d\n", f[n]);
  return 0;
}
