#include <bits/stdc++.h>
using namespace std;
int N, A, B, C, COST = 0;
vector<int> L;
int minl[3] = {100000, 100000, 100000};
void dfs(int index, int cost, int a, int b, int c) {
  if (index == L.size()) {
    if (abs(A - a) + abs(B - b) + abs(C - c) <
            abs(A - minl[0]) + abs(B - minl[1]) + abs(C - minl[2]) &&
        a != 0 && b != 0 && c != 0) {
      minl[0] = a;
      minl[1] = b;
      minl[2] = c;
      COST = cost;
    }
    return;
  }
  index++;
  dfs(index, cost, a, b, c);
  dfs(index, cost + 10, a + L[index - 1], b, c);
  dfs(index, cost + 10, a, b + L[index - 1], c);
  dfs(index, cost + 10, a, b, c + L[index - 1]);
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) {
    int l;
    cin >> l;
    L.push_back(l);
  }
  dfs(0, COST, 0, 0, 0);
  cout << COST - 30 + abs(A - minl[0]) + abs(B - minl[1]) + abs(C - minl[2])
       << endl;
  return 0;
}
