#include <bits/stdc++.h>
using namespace std;
int ans[4001];
int main() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  for (int i = 0; i < 4001; ++i) ans[i] = -1000000000;
  ans[a] = ans[b] = ans[c] = 1;
  ans[0] = 0;
  for (int i = 1; i <= n; ++i) {
    if (i - a >= 0) ans[i] = max(ans[i], ans[i - a] + 1);
    if (i - b >= 0) ans[i] = max(ans[i], ans[i - b] + 1);
    if (i - c >= 0) ans[i] = max(ans[i], ans[i - c] + 1);
  }
  cout << ans[n] << endl;
  return 0;
}
