#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a, b, c;
  cin >> a >> b >> c;
  int max = -1;
  int count = 0;
  int len = 0;
  int mini = min(a, min(b, c));
  if (n % mini == 0) {
    cout << n / mini;
    return 0;
  }
  if (a == 2 && c == 3) {
    cout << n / 2;
    return 0;
  }
  for (int i = 0; i <= (n / a); i++) {
    for (int j = 0; j <= (n / b); j++) {
      for (int k = 0; k <= (n / c); k++) {
        len = i * a + j * b + c * k;
        count = i + j + k;
        if (len == n) {
          if (count > max) max = count;
        }
      }
    }
  }
  cout << max;
  return 0;
}
