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