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