#include <bits/stdc++.h>
using namespace std;
unordered_map<string, int> lookup;
int ans(int len, int arr[], int n) {
  if (len == 0) return 1;
  if (len < 0 || n == 0) return 0;
  string key = to_string(len) + "|" + to_string(n);
  if (lookup.find(key) == lookup.end()) {
    int a = ans(len - arr[n - 1], arr, n);
    if (a > 0) a += 1;
    int b = ans(len, arr, n - 1);
    lookup[key] = max(a, b);
  }
  return lookup[key];
}
int main() {
  int len;
  int *arr = new int[3];
  cin >> len >> arr[0] >> arr[1] >> arr[2];
  int a = ans(len, arr, 3);
  if (a == 0)
    cout << a;
  else
    cout << a - 1;
  return 0;
}
