#include <bits/stdc++.h>
using namespace std;
int n, a, b, c;
int dp[5001];
int main() {
  cin >> n >> a >> b >> c;
  dp[0] = 0;
  for (int i = 1; i <= 5000; i++) dp[i] = -1e9;
  for (int i = 0; i <= 5000; i++) {
    if (i >= a) {
      dp[i] = max(dp[i], dp[i - a] + 1);
    }
    if (i >= b) dp[i] = max(dp[i], dp[i - b] + 1);
    if (i >= c) dp[i] = max(dp[i], dp[i - c] + 1);
  }
  cout << dp[n] << endl;
  return 0;
}
