#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e3 + 9;
int a, b, c, N;
int dp[MAXN];
inline int go(int len) {
  if (len == 0) return 0;
  if (len < a && len < b && len < c) return -MAXN;
  if (dp[len] != -1) return dp[len];
  return dp[len] = 1 + max(max(go(len - a), go(len - b)), go(len - c));
}
int main() {
  memset(dp, -1, sizeof(dp));
  scanf("%d %d %d %d", &N, &a, &b, &c);
  printf("%d\n", go(N));
  return 0;
}
