#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(T t) {
  cout << t << endl;
}
long long n = 0, t = 0;
long long small = -1e18, big = 1e18;
const long long mod = 1e9 + 7;
map<long long, long long> occ;
map<pair<long long, long long>, long long> occP;
void print2dVec(vector<vector<long long>> v) {
  for (int i = 0; i < v.size(); ++i) {
    cout << i << " : ";
    for (int j = 0; j < v[i].size(); ++j) {
      cout << v[i][j] << " ";
    }
    print("");
  }
}
void printSet(set<int> s) {
  for (auto itr = s.begin(); itr != s.end(); ++itr) {
    cout << *itr << " ";
  }
}
long long factorial(int n) {
  long long ans = 1;
  for (int i = 1; i <= n; ++i) {
    ans *= i;
  }
  return ans;
}
long long findGCD(long long a, long long b) {
  long long ans = 1;
  for (int i = 1; i <= min(a, b); ++i) {
    if (a % i == 0 && b % i == 0) {
      ans = i;
    }
  }
  return ans;
}
long long findLCM(long long a, long long b) {
  for (long long i = min(a, b); i <= a * b; ++i) {
    if (i % a == 0 && i % b == 0) {
      return i;
    }
  }
  return -1;
}
bool isPrime(int num) {
  if (num <= 1) return false;
  if (num <= 3) return true;
  int range = sqrt(num);
  if (num % 2 == 0 || num % 3 == 0) return false;
  for (int i = 5; i <= range; i += 6)
    if (num % i == 0 || num % (i + 2) == 0) return false;
  return true;
}
vector<long long> primeFactors(long long x) {
  vector<long long> fac;
  for (long long i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      while (x % i == 0) {
        fac.push_back(i);
        x /= i;
      }
    }
  }
  return fac;
}
bool sortVec(const vector<long long>& v1, const vector<long long>& v2) {
  return v1[0] < v2[0];
}
bool check(long long val) { return false; }
long long binsearch(long long low, long long high) {
  while (low < high) {
    long long mid = (low + high) / 2;
    if (check(mid)) {
      high = mid;
    } else {
      low = mid + 1;
    }
  }
  return low;
}
unordered_map<long long, long long> d;
long long rib(long long n, long long a, long long b, long long c) {
  if (n == 0) return 0;
  if (n < 0) return small;
  if (d.count(n))
    return d[n];
  else {
    d[n] = 1 + max(rib(n - a, a, b, c),
                   max(rib(n - b, a, b, c), rib(n - c, a, b, c)));
    return d[n];
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout << setprecision(10);
  ;
  long long n, a, b, c;
  cin >> n >> a >> b >> c;
  cout << rib(n, a, b, c);
  return 0;
}
