#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c;
  int x[3];
  cin >> n >> x[0] >> x[1] >> x[2];
  sort(x, x + 3);
  a = x[0], b = x[1], c = x[2];
  int ans[n + 1];
  fill(ans, ans + n + 1, INT_MIN);
  ans[0] = 0;
  for (int j = 1; j <= n; j++) {
    int mx = INT_MIN;
    if (j - a >= 0 && mx < ans[j - a]) mx = ans[j - a];
    if (j - b >= 0 && mx < ans[j - b]) mx = ans[j - b];
    if (j - c >= 0 && mx < ans[j - c]) mx = ans[j - c];
    ans[j] = 1 + mx;
  }
  cout << ans[n];
  return 0;
}
