#include <bits/stdc++.h>
using namespace std;
const long long INFLL = (long long)2000000001 * (long long)2000000001;
const long double EPS = 10e-9;
bool available[8007];
int best[8007];
int main() {
  int n;
  scanf("%d", &n);
  int a;
  scanf("%d", &a);
  int b;
  scanf("%d", &b);
  int c;
  scanf("%d", &c);
  available[0] = 1;
  for (int i = 0; i < n + 1; i++)
    if (available[i]) {
      best[i + a] = max(best[i + a], best[i] + 1);
      available[i + a] = 1;
    }
  for (int i = 0; i < n + 1; i++)
    if (available[i]) {
      best[i + b] = max(best[i + b], best[i] + 1);
      available[i + b] = 1;
    }
  for (int i = 0; i < n + 1; i++)
    if (available[i]) {
      best[i + c] = max(best[i + c], best[i] + 1);
      available[i + c] = 1;
    }
  printf("%d\n", best[n]);
}
