#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e4 + 1;
void display(vector<long long> dp, long long n) {
  long long i;
  for (i = 1; i <= n; i++) {
    cout << dp[i] << " ";
  }
  cout << endl;
}
void solve() {
  long long n, a, b, c;
  long long x, y, z;
  long long m, i;
  vector<long long> dp(maxn, 0);
  cin >> n >> a >> b >> c;
  dp[0] = 0;
  for (i = 1; i <= n; i++) {
    x = y = z = -1;
    if (i >= a) {
      x = dp[i - a];
    }
    if (i >= b) {
      y = dp[i - b];
    }
    if (i >= c) {
      z = dp[i - c];
    }
    if (x == -1 && y == -1 && z == -1) {
      dp[i] = -1;
    } else {
      dp[i] = max(x, max(y, z)) + 1;
    }
  }
  cout << dp[n] << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
