#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c, max = 0, maxX, maxY, maxZ, x, y, z;
  cin >> n >> a >> b >> c;
  for (x = 0; x <= n / a; x++) {
    for (y = 0; y <= n / b; y++) {
      if ((n - (x * a + y * b)) % c == 0 && n >= (x * a + y * b)) {
        z = (n - (x * a + y * b)) / c;
        int sum = x + y + z;
        if (sum > max) {
          max = sum;
          maxX = x;
          maxY = y;
          maxZ = z;
        }
      }
    }
  }
  cout << max << endl;
  return 0;
}
