#include <bits/stdc++.h>
const long long int inf = LLONG_MAX;
using namespace std;
int main() {
  int n, a[4], dp[4005] = {0}, i, j;
  dp[0] = 0;
  cin >> n >> a[0] >> a[1] >> a[2];
  for (i = 1; i <= n; i++) {
    for (j = 0; j < 3; j++) {
      if (i < a[j]) continue;
      if (dp[i - a[j]] != 0)
        dp[i] = max((1 + dp[i - a[j]]), dp[i]);
      else if (i == a[j])
        dp[i] = max(1, dp[i]);
    }
  }
  cout << dp[n];
  return 0;
}
