#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
int arr[4], Max[4005];
int main() {
  int x;
  cin >> x >> arr[0] >> arr[1] >> arr[2];
  sort(arr, arr + 3);
  for (int i = 1; i <= x; i++) {
    for (int j = 0; j < 3; j++) {
      if (i >= arr[j] && Max[i - arr[j]] + 1 > Max[i]) {
        if (i - arr[j] != 0) {
          if (Max[i - arr[j]] != 0)
            Max[i] = Max[i - arr[j]] + 1;
          else
            continue;
        } else
          Max[i] = Max[i - arr[j]] + 1;
      }
    }
  }
  cout << Max[x] << '\n';
  return 0;
}
