#include <bits/stdc++.h>
using namespace std;
int main() {
  long sum, i, j;
  cin >> sum;
  vector<long> length(3);
  for (i = 0; i < 3; i++) cin >> length[i];
  vector<vector<long> > dp(2, vector<long>(sum + 1, INT_MIN));
  dp[3 % 2][0] = 0;
  for (i = 2; i >= 0; i--) {
    for (j = 0; j <= sum; j++) {
      dp[i % 2][j] = dp[(i + 1) % 2][j];
      if (j - length[i] >= 0 && dp[i % 2][j - length[i]] != INT_MIN)
        dp[i % 2][j] = max(dp[i % 2][j], 1 + dp[i % 2][j - length[i]]);
    }
  }
  cout << dp[0][sum];
}
