#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  int arr[3];
  arr[0] = a;
  arr[1] = b;
  arr[2] = c;
  sort(arr, arr + 3);
  int max = -1;
  for (int i = 0; i <= n / arr[0]; ++i) {
    for (int j = 0; j <= n / arr[1]; ++j) {
      if ((n - arr[0] * i - arr[1] * j) % arr[2] == 0 &&
          (n - arr[0] * i - arr[1] * j) >= 0) {
        if (max < (i + j + (n - arr[0] * i - arr[1] * j) / arr[2]))
          max = (i + j + (n - arr[0] * i - arr[1] * j) / arr[2]);
      }
    }
  }
  cout << max;
}
