#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> adj;
vector<int> vis;
int pre = 0, d = 0;
void dfs(int k) {
  vis[k] = 1;
  for (int i = 0; i < adj[k].size(); i++) {
    if (vis[adj[k][i]] == 0) {
      dfs(adj[k][i]);
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, c, a, b;
  cin >> n >> a >> b >> c;
  int m = n;
  int m1 = min(a, min(b, c));
  int m3 = max(a, min(b, c));
  int m2 = a + b + c - m1 - m3;
  vector<int> cnt;
  for (int i = m / m1; i >= 0; i--) {
    for (int j = (m - m1 * i) / m2; j >= 0; j--) {
      if ((m - m1 * i - m2 * j) % m3 == 0) {
        cnt.push_back(i + j + (m - m1 * i - m2 * j) / m3);
      }
    }
  }
  int mat = 0;
  for (long long i = 0; i < cnt.size(); i++) {
    if (mat < cnt[i]) mat = cnt[i];
  }
  cout << mat << "\n";
}
