#include <bits/stdc++.h>
using namespace std;
void cut(long long int n, long long int a, long long int b, long long int c) {
  long long int T[n + 1];
  for (int i = 0; i < n + 1; i++) {
    long long int val1 = 0, val2 = 0, val3 = 0;
    if (i - a >= 0 && T[i - a]) val1 = 1 + T[i - a];
    if (i - b >= 0 && T[i - b]) val2 = 1 + T[i - b];
    if (i - c >= 0 && T[i - c]) val3 = 1 + T[i - c];
    T[i] = max(val1, max(val2, val3));
    if ((i == a || i == b || i == c) && T[i] == 0) T[i] = 1;
  }
  cout << T[n] << "\n";
}
int main() {
  long long int n, a, b, c;
  cin >> n >> a >> b >> c;
  cut(n, a, b, c);
}
