#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
long long lcm(long long x, long long y) { return x * y / gcd(x, y); }
bool prime(long long n) {
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
long long n, a, b, c, cnt = 0, infa = 0, infb = 0, infc = 0;
long long s[10];
signed main() {
  cin >> n >> a >> b >> c;
  for (long long i = 0; i < n; i++) cin >> s[i];
  sort(s, s + n);
  for (long long i = 0; i < n; i++) cnt += s[i];
  for (long long i = 0; i < n; i++) {
    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;
}
