#include <bits/stdc++.h>
using namespace std;
int n, a, b, c;
int dp[100000];
int f(int n) {
  if (dp[n] != -111) return dp[n];
  if (n <= 0) return 0;
  int ans = -999999;
  if (n - a >= 0) ans = max(ans, f(n - a));
  if (n - b >= 0) ans = max(ans, f(n - b));
  if (n - c >= 0) ans = max(ans, f(n - c));
  dp[n] = ans + 1;
  return ans + 1;
}
int main() {
  for (int i = 0; i < 100000; i++) dp[i] = -111;
  cin >> n >> a >> b >> c;
  cout << f(n);
}
