#include <bits/stdc++.h>
using namespace std;
const int lim = (int)2e9;
int main(int argc, char const *argv[]) {
  int n, a, b, c;
  scanf("%d %d %d %d", &n, &a, &b, &c);
  std::vector<int> dp(n + 1, -lim);
  dp[0] = 0;
  for (int i = 1; i <= n; 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);
  }
  printf("%d\n", dp[n]);
  return 0;
}
