#include <bits/stdc++.h>
using namespace std;
const int N = 4002;
int mem[N][N];
int a, b, c, n, minn;
int bt(int rem, int pre) {
  if (rem < 0) return -10000;
  if (rem == 0) return 0;
  int &reff = mem[rem][pre];
  if (reff != -1) return reff;
  int c1 = 0, c2 = 0, c3 = 0;
  c1 = bt(rem - a, a) + 1;
  c2 = bt(rem - b, b) + 1;
  c3 = bt(rem - c, c) + 1;
  return reff = max({c1, c2, c3});
}
int main() {
  memset(mem, -1, sizeof mem);
  scanf("%d%d%d%d", &n, &a, &b, &c);
  cout << bt(n, 0);
  return 0;
}
