#include <bits/stdc++.h>
using namespace std;
vector<int> A(3);
vector<vector<int> > dp(4010, vector<int>(4010, -1));
int f(int n, int c) {
  if (n == 0) return c;
  if (n < *min_element(begin(A), end(A))) return 0;
  int &x = dp[n][c];
  if (x != -1) return x;
  for (auto &i : A) {
    if (n >= i) x = max(x, f(n - i, c + 1));
  }
  return x;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (auto &i : A) cin >> i;
  cout << f(n, 0) << endl;
}
