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