#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<long long> dp(5000, 0);
  vector<bool> ok(5000, false);
  ok[0] = true;
  for (int i = 1; i <= n; i++) {
    dp[i] = -1;
    if (i - a >= 0 && ok[i - a]) {
      dp[i] = max(dp[i], dp[i - a] + 1);
      ok[i] = true;
    }
    if (i - b >= 0 && ok[i - b]) {
      dp[i] = max(dp[i], dp[i - b] + 1);
      ok[i] = true;
    }
    if (i - c >= 0 && ok[i - c]) {
      dp[i] = max(dp[i], dp[i - c] + 1);
      ok[i] = true;
    }
  }
  cout << dp[n];
}
