#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, a, b, c;
  cin >> n >> a >> b >> c;
  long long dp[n + 1];
  memset(dp, 0, sizeof(dp));
  for (long long i = 1; i <= n; i++) {
    if (i - a == 0 || i - b == 0 || i - c == 0) dp[i] = 1;
    if (i - a > 0 && dp[i - a] > 0) dp[i] = max(dp[i], 1 + dp[i - a]);
    if (i - b > 0 && dp[i - b] > 0) dp[i] = max(dp[i], 1 + dp[i - b]);
    if (i - c > 0 && dp[i - c] > 0) dp[i] = max(dp[i], 1 + dp[i - c]);
  }
  cout << dp[n];
  return 0;
}
