#include <bits/stdc++.h>
using namespace std;
int n, a, b, c;
int dp[4001];
int main() {
  scanf("%d%d%d%d", &n, &a, &b, &c);
  for (int i = 0; i <= n; ++i) dp[i] = -INT_MAX;
  dp[0] = 0;
  for (int i = a; i <= n; ++i) {
    dp[i] = max(dp[i], dp[i - a] + 1);
  }
  for (int i = b; i <= n; ++i) {
    dp[i] = max(dp[i], dp[i - b] + 1);
  }
  for (int i = c; i <= n; ++i) {
    dp[i] = max(dp[i], dp[i - c] + 1);
  }
  printf("%d", dp[n]);
  return 0;
}
