#include <bits/stdc++.h>
using namespace std;
inline long long gcd(long long a, long long b) {
  if (!a || !b) return a || b;
  while (a %= b ^= a ^= b ^= a)
    ;
  return b;
}
bool srt(int &a, int &b) { return a > b; }
bool srt(string &a, string &b) {
  if (a.size() > b.size())
    return true;
  else if (a.size() < b.size())
    return false;
  return 0;
}
vector<string> split(string &s, string delimiter) {
  vector<string> v;
  int f = s.find(delimiter), pos = 0;
  while (f > -1) {
    if (f - pos) v.emplace_back(s.substr(pos, f - pos));
    pos = f + delimiter.size();
    f = s.find(delimiter, pos);
  }
  v.emplace_back(s.substr(pos, s.size() - pos + 1));
  return v;
}
struct point {
  int x, y;
  bool operator<(point &b) { return x < b.x; }
};
template <typename T>
T mini(T a, T b) {
  return min(a, b);
}
template <typename T, typename... Args>
T mini(T a, Args... args) {
  return min(a, mini(args...));
}
template <typename T>
T maxi(T a, T b) {
  return max(a, b);
}
template <typename T, typename... Args>
T maxi(T a, Args... args) {
  return max(a, maxi(args...));
}
class A {
 private:
  int mx;
  int a, b, c;
  void func(int n, int s) {
    if (n == 0) {
      mx = max(mx, s);
      return;
    }
    if (n >= a) func(n - a, s + 1);
    if (n >= b) func(n - b, s + 1);
    if (n >= c) func(n - c, s + 1);
  }

 public:
  A() {
    mx = 0;
    int n;
    cin >> n >> a >> b >> c;
    int arr[4001] = {0};
    for (int(i) = (mini(a, b, c)); (i) < (n + 1); ++(i)) {
      for (int(j) = (mini(a, b, c)); (j) < (i / 2 + 1); ++(j)) {
        if (arr[i - j] && arr[j]) arr[i] = max(arr[i], arr[j] + arr[i - j]);
      }
      if (i == a || i == b || i == c) arr[i] = max(arr[i], 1);
    }
    cout << arr[n] << "\n";
  }
};
class B {
 private:
 public:
  B() {}
};
class Game {
 private:
  unsigned long long __gcd(unsigned long long x, unsigned long long y) {
    while (x && y) {
      if (x >= y)
        x %= y;
      else
        y %= x;
    }
    if (!x) return y;
    return x;
  }
  string tmp;
  char minchar(string &s) {
    char res = s[0];
    for (int(i) = (0); (i) < (s.size()); ++(i)) {
      res = min(res, s[i]);
    }
    return res;
  }
  char maxchar(string &s) {
    char res = s[0];
    for (int(i) = (0); (i) < (s.size()); ++(i)) {
      res = max(res, s[i]);
    }
    return res;
  }
  void Gen(string &s, int i, int j, unordered_map<string, bool> &maping) {
    if (i == s.size()) {
      if (minchar(s) >= '0' && maxchar(s) <= '9') maping[s] = 1;
      return;
    }
    s[i] = (tmp[i] + j);
    Gen(s, i + 1, j, maping);
    s[i] = (tmp[i] - j);
    Gen(s, i + 1, j, maping);
    s[i] = tmp[i];
  }

 public:
  Game() {
    int c, co = 1;
    cin >> c;
    while (co <= c) {
      int n, res = 0;
      scanf("%d", &n);
      unordered_map<string, bool> maping;
      for (int(i) = (0); (i) < (n); ++(i)) {
        string x;
        cin >> x;
        tmp = x;
        if (!maping[(x)]) {
          maping[(x)] = 1;
          for (int(j) = (1); (j) < (10); ++(j)) {
            Gen(x, 0, j, maping);
          }
          res++;
        }
      }
      printf("Case %d: %d\n", co, res);
      co++;
    }
  }
};
class C {
 private:
 public:
  C() {}
};
class D {
 private:
 public:
  D() {}
};
class E {
 private:
 public:
  E() {}
};
int main() { A(); }
