#include <bits/stdc++.h>
using namespace std;
vector<int> prime_Numbers;
bool primes[100005];
void prime(int n) {
  for (int i = 2; i <= n; i++) primes[i] = true;
  for (int i = 2; i <= n; i++) {
    if (primes[i] == true) {
      prime_Numbers.push_back(i);
      for (int j = i + i; j <= n; j += i) primes[j] = false;
    }
  }
}
int fib(int n) {
  if (n == 1 || n == 0) return n;
  return fib(n - 1) + fib(n - 2);
}
long long fastpower(int b, int p) {
  if (p == 0) return 1;
  long long term = fastpower(b, p / 2);
  term *= term;
  if (p % 2 != 0) return term *= b;
  return term;
}
int main() {
  int n, arr[3], mxm = -1;
  cin >> n >> arr[0] >> arr[1] >> arr[2];
  sort(arr, arr + 3);
  for (int i = 0; i <= arr[2]; i++) {
    for (int j = 0; j <= arr[1]; j++) {
      int c = n - (i * arr[2]) - (j * arr[1]);
      if (c >= 0 && c % arr[0] == 0) mxm = max(mxm, i + j + c / arr[0]);
    }
  }
  cout << mxm;
  return 0;
}
