#include <bits/stdc++.h>
using namespace std;
const long long N = 5050, inf = 0x3f3f3f3f3f3f3f3f;
long long dp[N], n, a, b, c;
inline long long Dp(long long x) {
  if (x < 0) return -inf;
  return dp[x];
}
signed main() {
  cin >> n >> a >> b >> c;
  for (long long i = 1; i <= n; ++i) {
    dp[i] = -inf;
  }
  dp[0] = 0;
  for (long long i = 1; i <= n; ++i) {
    dp[i] = max(Dp(i - a), max(Dp(i - b), Dp(i - c))) + 1;
  }
  cout << dp[n];
}
