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