#include <bits/stdc++.h>
using namespace std;
const int N = 4040, inF = 1e9;
int n, a, b, c, dp[N];
int main() {
  cin >> n >> a >> b >> c;
  dp[0] = 0;
  for (int i = 1; i <= n; i++) {
    dp[i] = -inF;
    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];
  return 0;
}
