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