#include <bits/stdc++.h>
using namespace std;
int N, A, B, C, minans;
vector<int> l(100, 0);
int dfs(int depth, vector<int> choice) {
  int a = 0, b = 0, c = 0, ans = 0, countera = -1, counterb = -1, counterc = -1;
  if (depth == N - 1) {
    for (int i = 0; i < N; i++) {
      if (choice[i] == 1) {
        a += l[i];
        countera++;
      }
      if (choice[i] == 2) {
        b += l[i];
        counterb++;
      }
      if (choice[i] == 3) {
        c += l[i];
        counterc++;
      }
    }
    if (countera < 0) countera = 0;
    if (counterb < 0) counterb = 0;
    if (counterc < 0) counterc = 0;
    ans = countera * 10 + counterb * 10 + counterc * 10 + abs(A - a) +
          abs(B - b) + abs(C - c);
    minans = min(ans, minans);
    return minans;
  } else {
    for (int i = 0; i < 4; i++) {
      choice[depth + 1] = i;
      ans = dfs(depth + 1, choice);
      minans = (ans, minans);
    }
  }
}
int main() {
  minans = 100000000;
  N = 0;
  A = 0;
  B = 0;
  C = 0;
  int result = 0;
  cin >> N >> A >> B >> C;
  vector<int> choice(N, 0);
  for (int i = 0; i < N; i++) cin >> l[i];
  for (int i = 0; i < 4; i++) {
    choice[0] = i;
    result = dfs(0, choice);
    minans = min(result, minans);
  }
  cout << minans;
}
