#include <bits/stdc++.h>
using namespace std;
int solvedp(int arr[], int n, int m) {
  int dp[n + 1][m + 1];
  int i, j, k;
  for (i = 0; i <= n; i++) {
    dp[i][0] = 1;
  }
  for (j = 1; j <= m; j++) {
    dp[0][j] = 0;
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      if (j < arr[i - 1]) {
        dp[i][j] = dp[i - 1][j];
      } else {
        int k = dp[i][j - arr[i - 1]];
        if (k && j - arr[i - 1]) {
          k++;
        }
        dp[i][j] = max(dp[i - 1][j], k);
      }
    }
  }
  return dp[n][m];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  int arr[3];
  arr[0] = a;
  arr[1] = b;
  arr[2] = c;
  cout << solvedp(arr, 3, n);
}
