#include <bits/stdc++.h>
using namespace std;
int n, a, b, c;
int ans = 1e9;
vector<int> abc(8);
vector<int> L(8);
void calc() {
  int now = 0;
  int la, lb, lc = 0;
  int ca, cb, cc = 0;
  for (int i = 0; i < n; i++) {
    if (abc.at(i) == 0) {
      ca++;
      la += L.at(i);
    } else if (abc.at(i) == 1) {
      cb++;
      lb += L.at(i);
    } else if (abc.at(i) == 2) {
      cc++;
      lc += L.at(i);
    }
  }
  if (ca == 0 || cb == 0 || cc == 0)
    return;
  else {
    now += 10 * (ca + cb + cc - 3) + abs(la - a) + abs(lb - b) + abs(lc - c);
    ans = min(ans, now);
  }
}
void dfs(int depth) {
  if (depth == n) {
    calc();
    return;
  } else {
    for (int i = 0; i < 4; i++) {
      abc.at(depth) = i;
      dfs(depth + 1);
    }
  }
}
int main() {
  cin >> n >> a >> b >> c;
  for (int i = 0; i < n; i++) {
    cin >> L.at(i);
  }
  dfs(0);
  cout << ans << endl;
}
