#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define double long double
using namespace std;
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
bool prime(ll n) {
	for (int i = 2; i*i <= n; i++) {
		if (n%i == 0)return false;
	}
	return true;
}
ll n, a, b, c, cnt = 0, infa = 0, infb = 0, infc = 0; ll s[10];
signed main() {
	cin >> n >> a >> b >> c;
	rep(i, n)cin >> s[i];
	sort(s, s + n);
	rep(i, n)cnt += s[i];
	rep(i, n) {
		if (s[i] - a <= 10) {
			cnt -= 10 - (s[i] - a);
			infa = 1;
			if (s[i] - b <= 10) {
				cnt -= 10 - (s[i] - b);
				infb = 1;
			}
			if (s[i] - c <= 10) {
				cnt -= 10 - (s[i] - c);
				infc = 1;
			}
	}
		cout << cnt + 10 * n - 3 - (infa + infb + infc) << endl;
	getchar(); getchar(); return 0;
}
