#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int sum, a, b, c;
  cin >> sum >> a >> b >> c;
  vector<int> v(4000);
  v[0] = 0;
  for (int i = 1; i <= sum; i++) {
    v[i] = INT_MIN;
    if (i >= a) v[i] = v[i - a] + 1;
    if (i >= b && v[i] < v[i - b] + 1) v[i] = v[i - b] + 1;
    if (i >= c && v[i] < v[i - c] + 1) v[i] = v[i - c] + 1;
  }
  cout << v[sum];
}
