#include <bits/stdc++.h>
using namespace std;
long long int INF = 1e9 + 5;
long long int mod = 998244353;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<long long int> dp(n + 1, -INF);
  dp[0] = 0;
  for (long long int i = 1; i <= n; i++) {
    dp[i] =
        max({dp[i], (i >= a ? dp[i - a] + 1 : -INF),
             (i >= b ? dp[i - b] + 1 : -INF), (i >= c ? dp[i - c] + 1 : -INF)});
  }
  cout << dp[n] << "\n";
}
