#include <bits/stdc++.h>
using namespace std;
int n;
int ans[100005];
void solve() {
  int a, b, c;
  cin >> n >> a >> b >> c;
  ans[a] = ans[b] = ans[c] = 1;
  for (int i = 0; i <= n; ++i) {
    ans[i + a] = max(ans[i + a], (ans[i] != 0) * (1 + ans[i]));
    ans[i + b] = max(ans[i + b], (ans[i] != 0) * (1 + ans[i]));
    ans[i + c] = max(ans[i + c], (ans[i] != 0) * (1 + ans[i]));
  }
  cout << ans[n];
  return;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
