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