#include <bits/stdc++.h>
using namespace std;
int n, a, b, c;
int inf = 1000000;
vector<int> l;
int dfs(int cur, int ax, int bx, int cx) {
  if (cur == n) {
    if (ax < 0 || bx < 0 || cx < 0)
      return inf;
    else
      return abs(ax - a) + abs(bx - b) + abs(cx - c);
  }
  int res = dfs(cur + 1, ax, bx, cx);
  int res1 = dfs(cur + 1, ax + l[cur], bx, cx) + (ax ? 10 : 0);
  int res2 = dfs(cur + 1, ax, bx + l[cur], cx) + (bx ? 10 : 0);
  int res3 = dfs(cur + 1, ax, bx, cx + l.at(cur)) + (cx ? 10 : 0);
  int num = min(res, res1);
  num = min(num, res2);
  num = min(num, res3);
  return num;
}
int main() {
  cin >> n >> a >> b >> c;
  l.resize(n);
  for (int i = 0; i < (int)(n); i++) cin >> l[i];
  cout << dfs(0, 0, 0, 0) << endl;
}
