#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[3], i, j;
  cin >> n >> a[0] >> a[1] >> a[2];
  int dp[4100][4];
  memset(dp, 0, sizeof(dp));
  sort(a, a + 3);
  for (j = a[2]; j <= n; j += j) {
    dp[j][2] += 1 + dp[j - a[2]][2];
  }
  dp[a[0]][0] = 1;
  dp[a[1]][1] = 1;
  for (i = 1; i >= 0; i--) {
    for (j = a[i] + 1; j <= n; j++) {
      int imd = 0;
      if (dp[j - a[i]][i] || dp[j - a[i]][i + 1])
        imd = 1 + max(dp[j - a[i]][i], dp[j - a[i]][i + 1]);
      dp[j][i] = max(dp[j][i + 1], imd);
    }
  }
  cout << dp[n][0];
}
