#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
int t = 1, ar[3];
int dp[5000];
long long recur(int n) {
  if (n == 0) {
    return 0;
  }
  if (dp[n] != -1) {
    return dp[n];
  }
  long long count = INT_MIN;
  for (int i = 0; i < 3; i++) {
    if (ar[i] <= n) {
      count = max(count, 1 + recur(n - ar[i]));
    }
  }
  return dp[n] = count;
}
void solve() {
  int n;
  cin >> n;
  for (int i = 0; i < 3; i++) {
    cin >> ar[i];
  }
  memset(dp, -1, sizeof dp);
  cout << recur(n) << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  while (t--) {
    solve();
  }
  return 0;
}
