#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
int lcm(int x, int y) { return x * y / gcd(x, y); }
long long int gcd(long long int x, long long int y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
long long int lcm(long long int x, long long int y) {
  return x * y / gcd(x, y);
}
void swap(long long int& x, long long int& y) {
  long long int temp = x;
  x = y;
  y = temp;
}
long long int binpow(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
long long int binpowM(long long int a, long long int b) {
  a %= 100000007;
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % 100000007;
    a = a * a % 100000007;
    b >>= 1;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed;
  int n, ans = 0, k;
  cin >> n;
  vector<int> a(3);
  for (int i = 0; i < 3; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end(), greater<int>());
  int i = 0, j, l = n / a[1], m = n / a[0];
  while (i <= m) {
    j = 0;
    while (j <= l) {
      k = n - i * a[0] - j * a[1];
      if (k % a[2] == 0) {
        ans = max(i + j + k / a[2], ans);
      }
      j++;
    }
    i++;
  }
  cout << ans << endl;
  return 0;
}
