#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  int arr[n + 1];
  memset(arr, -1, sizeof(arr));
  arr[0] = 0;
  for (int i = 1; i <= n; i++) {
    if (i >= a && arr[i - a] != -1) arr[i] = max(arr[i - a] + 1, arr[i]);
    if (i >= b && arr[i - b] != -1) arr[i] = max(arr[i - b] + 1, arr[i]);
    if (i >= c && arr[i - c] != -1) arr[i] = max(arr[i - c] + 1, arr[i]);
  }
  cout << arr[n];
  return 0;
}
