#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, lol[3];
  cin >> n >> lol[0] >> lol[1] >> lol[2];
  sort(lol, lol + 3);
  int i, j, k;
  int x = n / lol[0];
  if (n % lol[0] == 0) {
    printf("%d\n", x);
    return 0;
  }
  int y = n / lol[1];
  int z = n / lol[2];
  int max = 0;
  for (i = x; i >= 0; i--) {
    for (j = y; j >= 0; j--) {
      for (k = z; k >= 0; k--) {
        if (i * lol[0] + j * lol[1] + k * lol[2] == n) {
          if (i + j + k > max) max = i + j + k;
          if (lol[0] + lol[1] < lol[2]) {
            continue;
          } else {
            printf("%d", max);
            return 0;
          }
        }
      }
    }
  }
  cout << max << endl;
  return 0;
}
