#include <bits/stdc++.h>
using namespace std;
int main() {
  int tt = 1;
  while (tt--) {
    int n, a, b, c;
    cin >> n >> a >> b >> c;
    int mv = min(min(a, b), c);
    int q = n / mv, ans = 0;
    for (int x = 0; x <= q; x++) {
      for (int y = 0; y <= q - x; y++) {
        float z = ((n - x * a - y * b) * 1.0) / c;
        if (z == (int)z && z >= 0) ans = max(ans, x + y + (int)z);
      }
    }
    cout << ans;
  }
}
