#include <bits/stdc++.h>
using namespace std;
const int N = 2e4 + 3;
const int mod = 1e9 + 7;
const int INF = INT_MAX;
int dp[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  dp[a] = 1;
  dp[b] = 1;
  dp[c] = 1;
  for (int i = min(a, min(b, c)) + 1; i <= n; i++) {
    if (i > a && dp[i - a] > 0) dp[i] = max(dp[i], dp[i - a] + 1);
    if (i > b && dp[i - b] > 0) dp[i] = max(dp[i], dp[i - b] + 1);
    if (i > c && dp[i - c] > 0) dp[i] = max(dp[i], dp[i - c] + 1);
  }
  cout << dp[n];
}
