#include <bits/stdc++.h>
using namespace std;
vector<int> dp(4001, -1);
int n, a, b, c;
int ribbons(int n) {
  if (n < 0) return -1e9;
  if (n == 0) return 0;
  if (dp[n] != -1) return dp[n];
  return dp[n] = max(max(1 + ribbons(n - a), 1 + ribbons(n - b)),
                     1 + ribbons(n - c));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> a >> b >> c;
  cout << ribbons(n);
}
