#include <bits/stdc++.h>
using namespace std;
long long f(long long x, long long y, long long n,
            unordered_map<long long, long long> &mp) {
  long long num;
  if (n == 1)
    num = x;
  else if (n == 2)
    num = y;
  else if (mp.find(n) != mp.end())
    num = mp[n];
  else
    num = (f(x, y, n - 1, mp) % 1000000007 - f(x, y, n - 2, mp) % 1000000007) %
          1000000007;
  mp[n] = num;
  return num % 1000000007;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  unordered_map<int, int> bottles;
  unordered_map<int, vector<int>> open;
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  int d[] = {a, b, c};
  vector<vector<int>> dp(n + 1, vector<int>(4));
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= 3; j++) {
      if (i == 0)
        dp[i][j] = 0;
      else if (j == 0)
        dp[i][j] = INT_MIN;
      else {
        if (i - d[j - 1] >= 0)
          dp[i][j] = max(dp[i][j - 1], 1 + dp[i - d[j - 1]][j]);
        else
          dp[i][j] = dp[i][j - 1];
      }
    }
  }
  cout << dp[n][3];
  return 0;
}
