#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[4];
  cin >> n >> a[1] >> a[2] >> a[3];
  a[0] = 0;
  sort(a, a + 4);
  int cuts[4][n + 1];
  memset(cuts, 0, sizeof(cuts));
  for (int i = 1; i <= 3; i++) {
    for (int j = 1; j <= n; j++) {
      if (j < a[i])
        cuts[i][j] = cuts[i - 1][j];
      else {
        if (j == a[i])
          cuts[i][j] = max(cuts[i - 1][j], 1);
        else {
          int k = j - a[i];
          if (cuts[i][k] != 0)
            cuts[i][j] = max(1 + cuts[i][k], cuts[i - 1][j]);
          else
            cuts[i][j] = cuts[i - 1][j];
        }
      }
    }
  }
  cout << cuts[3][n];
}
