#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
long long a, b, c;
void test_case() {
  long long n;
  cin >> n >> a >> b >> c;
  long long ans = 0;
  for (long long x = 0; x * a <= n; x++) {
    for (long long y = 0; y * b <= n; y++) {
      long long rem = n - x * a - y * b;
      if (rem % c == 0 && rem >= 0) {
        ans = max(ans, x + y + rem / c);
      }
    }
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) {
    test_case();
  }
  return 0;
}
