#include <bits/stdc++.h>
using namespace std;
int mem[4001];
int s[3];
int solve(int n) {
  if (n == 0) return 0;
  if (n < 0) return -1e9;
  int &ret = mem[n];
  if (ret != -1) return ret;
  ret = -1e9;
  for (int i = 0; i < 3; i++) ret = max(ret, 1 + solve(n - s[i]));
  return ret;
}
int main() {
  int n;
  while (cin >> n) {
    for (int i = 0; i < 3; i++) cin >> s[i];
    memset(mem, -1, sizeof mem);
    cout << solve(n) << endl;
  }
}
