#include <bits/stdc++.h>
using namespace std;
long a, b, c, n, k, pas;
int main() {
  cin >> n >> a >> b >> c;
  for (int i = 0; i <= n / a; i++)
    for (int j = 0; j <= (n - a * i) / b; j++) {
      k = n - i * a - j * b;
      if (k % c == 0) {
        if (pas < i + j + k / c) {
          pas = i + j + k / c;
        }
      }
    }
  cout << pas;
}
