#include <bits/stdc++.h>
using namespace std;
long long a, b[4], k, dp[4005];
long long z(long long a) {
  if (a == 0) {
    return 0;
  } else if (a < 0) {
    return -10000000;
  }
  if (dp[a] == 0) {
    long long k = -3333000;
    for (int i = 1; i <= 3; i++) {
      k = max(z(a - b[i]), k);
    }
    dp[a] = k + 1;
  }
  return dp[a];
}
int main() {
  cin >> a;
  for (int i = 1; i <= 3; i++) {
    cin >> b[i];
  }
  cout << z(a) << endl;
}
