#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[4];
  scanf("%d%d%d%d", &n, &a[1], &a[2], &a[3]);
  int ans = 0;
  int r = min(a[1], min(a[2], a[3]));
  r = n / r;
  for (int x = r; x >= 0; x--) {
    for (int y = 0; y <= r; y++) {
      int z = abs((n - (a[1] * x + a[2] * y)) / a[3]);
      if (a[1] * x + a[2] * y + a[3] * z == n) {
        ans = max(ans, x + y + z);
      }
    }
  }
  cout << ans << endl;
}
