#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int i, j, n, a, b, c, m, s = 1;
  cin >> n >> a >> b >> c;
  for (i = 0; i <= 4000; i++)
    for (j = 0; j <= 4000; j++) {
      m = n - a * i - b * j;
      if (m >= 0 && m % c == 0) s = std::max(s, i + j + m / c);
    }
  cout << s;
  return 0;
}
