#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 fnc(int id) {
  if (id > n) return 0;
  if (id == n) return 1;
  if (dp[id] != -1) return dp[id];
  int t1 = max(fnc(id + a), max(fnc(id + b), fnc(id + c)));
  if (t1 > 0) t1++;
  dp[id] = t1;
  return dp[id];
}
int main() {
  int t, m, i, j, k, l, ans, count, temp, sum, flag;
  cin >> n >> a >> b >> c;
  memset(dp, -1, sizeof(dp));
  ;
  cout << fnc(0) - 1;
  return 0;
}
