#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  vector<int> M(N + 1, -100000);
  M[0] = 0;
  for (int i = 1; i <= N; ++i)
    M[i] =
        max({i >= A ? M[i - A] + 1 : -100000, i >= B ? M[i - B] + 1 : -100000,
             i >= C ? M[i - C] + 1 : -100000});
  cout << M[N] << "\n";
  return 0;
}
