#include <bits/stdc++.h>
using namespace std;
int dp[4001];
int main() {
  ios::sync_with_stdio(false);
  int n, a, b, c, i;
  cin >> n >> a >> b >> c;
  fill(dp, dp + n + 1, INT_MIN);
  dp[0] = 0;
  for (i = 0; i < 4001; 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;
}
