#include <bits/stdc++.h>
using namespace std;
inline void scanint(int &x) {
  register int c = 0;
  x = 0;
  int flag = 0;
  for (; ((c != 45) && (c < 48 || c > 57)); c = getchar())
    ;
  for (; ((c == 45) || (c > 47 && c < 58)); c = getchar()) {
    if (c == 45)
      flag = 1;
    else
      x = (x << 1) + (x << 3) + c - 48;
  }
  if (flag) x = -x;
}
int dp[10000];
int n, a, b, c;
int main() {
  int t, m, i, j, k, l, ans, count, temp, sum, flag;
  cin >> n >> a >> b >> c;
  for (i = 1; i < n + 1; i++) {
    dp[i] = -9382493;
    if (i >= a) dp[i] = dp[i - a] + 1;
    if (i >= b) dp[i] = max(dp[i], dp[i - b] + 1);
    if (i >= c) dp[i] = max(dp[i], dp[i - c] + 1);
  }
  cout << dp[n];
  return 0;
}
