#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
using namespace std;
ifstream fin("AAtest.in.txt");
int n, a, b, c, vas;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cerr.tie(0);
  cin >> n >> a >> b >> c;
  int aa = 0, vas = 0;
  while (aa <= n) {
    int bb = 0;
    while (bb <= n - aa) {
      int cc = n - aa - bb;
      if (!(cc % c)) vas = max(vas, aa / a + bb / b + cc / c);
      bb += b;
    }
    aa += a;
  }
  cout << vas;
}
