#include <bits/stdc++.h>
using namespace std;
int dp[4001];
int max(int a, int b, int c) {
  if (a >= b && a >= c)
    return a;
  else if (b >= a && b >= c)
    return b;
  else
    return c;
}
int ribbons(int n, int a, int b, int c, int minl) {
  if (n == 0)
    return 0;
  else if (n < minl)
    return -10000000;
  else if (dp[n] != -1)
    return dp[n];
  return dp[n] = 1 + max(ribbons(n - a, a, b, c, minl),
                         ribbons(n - b, a, b, c, minl),
                         ribbons(n - c, a, b, c, minl));
}
int main(int argc, char const *argv[]) {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  int minl = min(a, min(b, c));
  memset(dp, -1, sizeof(dp));
  cout << ribbons(n, a, b, c, minl);
  return 0;
}
