#include <bits/stdc++.h>
int max(int a, int b) { return a > b ? a : b; }
int dp[4003];
int main() {
  int a[3];
  int n, i, j, temp;
  while (scanf("%d%d%d%d", &n, &a[0], &a[1], &a[2]) != EOF) {
    memset(dp, 0, sizeof(dp));
    for (i = 0; i < 2; i++)
      for (j = i + 1; j < 3; j++) {
        if (a[i] > a[j]) {
          temp = a[i];
          a[i] = a[j];
          a[j] = temp;
        }
      }
    for (i = 0; i < 3; i++) {
      for (j = a[i]; j <= n; j++) {
        if (j % a[i] == 0) {
          dp[j] = max(dp[j - a[i]] + 1, dp[j]);
        } else if ((j - a[i]) >= a[0] && dp[j - a[i]] != 0) {
          dp[j] = max(dp[j - a[i]] + 1, dp[j]);
        }
      }
    }
    printf("%d\n", dp[n]);
  }
  return 0;
}
