#include <bits/stdc++.h>
using namespace std;
int main() {
  long int i, j, ae, be, ce, ne, ke, ans, rem;
  while (cin >> ne >> ae >> be >> ce) {
    ans = 0;
    for (i = 0; i * ae <= ne; ++i) {
      for (j = 0; i * ae + j * be <= ne; ++j) {
        rem = ne - i * ae - j * be;
        if (rem % ce == 0) {
          ke = rem / ce;
          ans = max(ans, i + j + ke);
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
