#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int a[3];
  int n;
  cin >> n;
  for (int i = 0; i < 3; i++) cin >> a[i];
  sort(a, a + 3);
  int x = n / a[2] + 1, y = n / a[1] + 1, z = n / a[0] + 1;
  int piece = 0;
  int flag = 0;
  if (n % a[0] == 0) {
    cout << n / a[0];
    return 0;
  }
  for (int i = 0; i <= x; i++) {
    for (int j = 0; j <= y; j++) {
      if (a[0] == a[1]) {
        if (a[1] * j + a[2] * i == n) {
          piece = max(piece, i + j);
          break;
        }
      } else
        for (int k = 0; k <= z; k++) {
          if (a[0] * k + a[1] * j + a[2] * i == n) {
            piece = max(piece, i + j + k);
            break;
          }
        }
    }
    if (a[1] == a[2]) break;
  }
  cout << piece;
  return 0;
}
