#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  int sum = 0;
  int x1 = n / a;
  int x2 = n / b;
  for (int i = 0; i <= x1; i++) {
    for (int j = 0; j <= x2; j++) {
      int x3 = n - i * a - j * b;
      if (x3 % c != 0 || x3 < 0) continue;
      int x4 = x3 / c;
      sum = max(sum, i + j + x4);
    }
  }
  cout << sum << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  while (t--) {
    solve();
  }
}
