#include <bits/stdc++.h>
using namespace std;
void pairsort(long long a[], long long b[], long long n) {
  pair<long long, long long> pairt[n];
  for (long long i = 0; i < n; i++) {
    pairt[i].first = a[i];
    pairt[i].second = b[i];
  }
  sort(pairt, pairt + n);
  for (long long i = 0; i < n; i++) {
    a[i] = pairt[i].first;
    b[i] = pairt[i].second;
  }
}
long long binomialCoeff(long long n, long long k) {
  long long res = 1;
  if (k > n - k) k = n - k;
  for (long long i = 0; i < k; ++i) {
    res *= (n - i);
    res /= (i + 1);
  }
  return res;
}
void printVector(vector<long long> v) {
  for (long long i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  cout << "\n";
}
long long divisor(long long num) {
  long long div = 0;
  for (long long i = 1; i <= num; i++) {
    if (num % i == 0) div++;
  }
  return div;
}
long long sub(long long a, long long b) {
  if (a >= b) return a - b;
  return b - a;
}
const long long N = 1e5;
long long dp[N];
long long d_p(long long n, long long a, long long b, long long c) {
  if (n == 0) return 0;
  if (n < (a < (b < c ? b : c) ? a : (b < c ? b : c)) && n != 0)
    return -9999;
  else {
    if (dp[n] != 0) return dp[n];
    return dp[n] = ((d_p(n - a, a, b, c) > d_p(n - b, a, b, c)
                         ? d_p(n - a, a, b, c)
                         : d_p(n - b, a, b, c)) > d_p(n - c, a, b, c)
                        ? (d_p(n - a, a, b, c) > d_p(n - b, a, b, c)
                               ? d_p(n - a, a, b, c)
                               : d_p(n - b, a, b, c))
                        : d_p(n - c, a, b, c)) +
                   1;
  }
}
int32_t main() {
  long long n, a, b, c;
  cin >> n >> a >> b >> c;
  long long ans;
  ans = d_p(n, a, b, c);
  cout << ans << "\n";
  return 0;
}
