#include <bits/stdc++.h>
using namespace std;
int n, a, b, c;
int l[8];
int getCost(int i, string s) {
  int res = (1e9);
  if (i == n) {
    int aa = a;
    int bb = b;
    int cc = c;
    int sza = 0;
    int szb = 0;
    int szc = 0;
    for (auto i = 0; i < (n); i++) {
      if (s[i] == 'a') {
        aa -= l[i];
        sza++;
      }
      if (s[i] == 'b') {
        bb -= l[i];
        szb++;
      }
      if (s[i] == 'c') {
        cc -= l[i];
        szc++;
      }
    }
    res = abs(aa) + abs(bb) + abs(cc) + max((sza - 1) * 10, 0) +
          max((szb - 1) * 10, 0) + max((szc - 1) * 10, 0);
  } else {
    res = min(res, getCost(i + 1, s + 'a'));
    res = min(res, getCost(i + 1, s + 'b'));
    res = min(res, getCost(i + 1, s + 'c'));
    res = min(res, getCost(i + 1, s + 'x'));
  }
  return res;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> a >> b >> c;
  for (int i = 0; i < (n); i++) scanf("%d", &l[i]);
  ;
  cout << getCost(0, "") << endl;
}
