#include <bits/stdc++.h>
using namespace std;
int a[4][4001];
int k[3];
int main() {
  int n, v, b, c, ans = 0;
  cin >> n >> k[0] >> k[1] >> k[2];
  for (int i = 1; i <= 3; i++) {
    for (int j = 1; j <= n; j++) {
      if (j < k[i - 1])
        a[i][j] = a[i - 1][j];
      else if (j >= k[i - 1]) {
        if (a[i][j - k[i - 1]] != 0 || j - k[i - 1] == 0) {
          a[i][j] = max(a[i - 1][j], a[i][j - k[i - 1]] + 1);
        } else
          a[i][j] = a[i - 1][j];
      }
    }
  }
  cout << a[3][n] << endl;
  return 0;
}
