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