#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  int dp[n + 1];
  dp[0] = 0;
  int dpa, dpb, dpc;
  for (int i = 1; i <= n; ++i) {
    dpa = (i - a >= 0) ? dp[i - a] : -1;
    dpb = (i - b >= 0) ? dp[i - b] : -1;
    dpc = (i - c >= 0) ? dp[i - c] : -1;
    dp[i] = max(dpa, max(dpb, dpc));
    dp[i] = (dp[i] == -1) ? -1 : dp[i] + 1;
  }
  cout << dp[n] << "\n";
  return 0;
}
