#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e7;
int _par[MAX_N];
int _rank[MAX_N];
void init(int n) {
  for (int i = 0; i < n; i++) {
    _par[i] = i;
    _rank[i] = 0;
  }
}
int find(int x) {
  if (_par[x] == x) {
    return x;
  } else {
    return _par[x] = find(_par[x]);
  }
}
void unite(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y) return;
  if (_rank[x] < _rank[y]) {
    _par[x] = y;
  } else {
    _par[y] = x;
    if (_rank[x] == _rank[y]) _rank[x]++;
  }
}
bool same(int x, int y) { return find(x) == find(y); }
int main() {
  int N, A, B, C;
  int ans = INT_MAX;
  cin >> N >> A >> B >> C;
  int l[N];
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }
  for (int i1 = 0; i1 < 4; i1++) {
    for (int i2 = 0; i2 < 4; i2++) {
      for (int i3 = 0; i3 < 4; i3++) {
        for (int i4 = 0; i4 < 4; i4++) {
          for (int i5 = 0; i5 < 4; i5++) {
            for (int i6 = 0; i6 < 4; i6++) {
              for (int i7 = 0; i7 < 4; i7++) {
                for (int i8 = 0; i8 < 4; i8++) {
                  init(4);
                  _par[0] = i1;
                  _par[1] = i2;
                  _par[2] = i3;
                  _par[3] = i4;
                  _par[4] = i5;
                  _par[5] = i6;
                  _par[6] = i7;
                  _par[7] = i8;
                  int cost = 0;
                  int A_tmp = 0;
                  int B_tmp = 0;
                  int C_tmp = 0;
                  int A_count = 0;
                  int B_count = 0;
                  int C_count = 0;
                  for (int i = 0; i < N; i++) {
                    if (_par[i] == 1) {
                      C_tmp += l[i];
                      C_count += 1;
                      if (C_count > 1) cost += 10;
                    }
                    if (_par[i] == 2) {
                      B_tmp += l[i];
                      B_count += 1;
                      if (B_count > 1) cost += 10;
                    }
                    if (_par[i] == 3) {
                      A_tmp += l[i];
                      A_count += 1;
                      if (A_count > 1) cost += 10;
                    }
                  }
                  cost += abs(A - A_tmp) + abs(B - B_tmp) + abs(C - C_tmp);
                  ans = min(cost, ans);
                }
              }
            }
          }
        }
      }
    }
  }
  cout << ans << endl;
}
