#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, a, b, c;
  int res = 0;
  cin >> n >> a >> b >> c;
  for (int i = 0; i <= n / a; ++i) {
    for (int j = 0; a * i + b * j <= n; ++j) {
      int k = (n - a * i - b * j) / c;
      if (a * i + b * j + c * k == n) {
        res = max(res, i + j + k);
      }
    }
  }
  cout << res << "\n";
  return 0;
}
