#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<vll> vvll;
typedef vector<vector<char>> vvc;
#define int ll
#define sz(s) (ll)s.size()
#define all(s) (s).begin(),(s).end()
#define rall(s) (s).begin(),(s).end(),greater<>()
#define ln '\n'
#define rtv(n) return void(cout<<n)
#define fixset(n) cout<<fixed<<setprecision(n)
#define getunique(v){sort(all(v));v.erase(unique(all(v)), v.end());}
#define input(a) for(auto&it:a)cin>>it;
#define print(a) for(auto&it:a)cout<<it<<" ";cout<<ln;
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// less: it is the basic for comparison of two function. Use less_equal for ordered multiset.
// order_of_key(k): Number of items strictly smaller than k
// find_by_order(k): kth element in a set (counting from zero)
const int MOD = 1e9 + 7;
const int MX = 1e5 + 2;
void Sayman369() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
}
void file() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#else
// freopen("mex.in", "r", stdin);
// freopen("output.txt", "w", stdout);
#endif
}
void preprocessing() {
}
const int N = 5e4;
int dp[N];
int n;
vll a;
int rec(int sum) {
if (sum < 0)return -1e5;
if (sum == 0)return 0;
int &ret = dp[sum];
if (~ret)return ret;
for (auto &i: a) {
ret = max(ret, rec(sum - i) + 1);
}
return ret;
}
void solve(int tc) {
cin >> n;
a.resize(3);
input(a);
memset(dp, -1, sizeof dp);
cout << rec(n);
}
signed main() {
Sayman369();
file();
preprocessing();
int tc = 1;
// cin >> tc;
for (int i = 1; i <= tc; i++) {
solve(i);
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNpbmNsdWRlIDxleH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