#include <bits/stdc++.h>
using namespace std;
long long dp[10000100];
long long a, b, c;
long long rec(long long n) {
  if (n < 0) return -1e18;
  if (n == 0) return 0;
  if (dp[n] != -1) return dp[n];
  long long res1 = rec(n - a) + 1;
  long long res2 = rec(n - b) + 1;
  long long res3 = rec(n - c) + 1;
  long long k = max(res1, res2);
  return dp[n] = max(k, res3);
}
int main() {
  memset(dp, -1, sizeof(dp));
  long long n;
  cin >> n;
  cin >> a >> b >> c;
  cout << rec(n);
  return 0;
}
