#include <bits/stdc++.h>
using namespace std;
vector<int> v(8), L(8);
int Min = 1000000000, N, A, B, C;
void calc(vector<int> &vec, int N) {
  int a = 0, b = 0, c = 0, cnt_a = 0, cnt_b = 0, cnt_c = 0;
  for (int i = 0; i < N; i++) {
    if (v[i] == 0) a += L[i], cnt_a++;
    if (v[i] == 1) b += L[i], cnt_b++;
    if (v[i] == 2) c += L[i], cnt_c++;
  }
  int ans = 10 * (max(0, cnt_a - 1) + max(0, cnt_b - 1) + max(0, cnt_c - 1)) +
            abs(a - A) + abs(b - B) + abs(c - C);
  if (Min > ans) Min = ans;
  return;
}
void dfs(int depth) {
  if (depth == N) {
    calc(v, N);
    return;
  }
  for (int i = 0; i < 4; i++) {
    v[depth] = i;
    dfs(depth + 1);
  }
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) cin >> L[i];
  dfs(0);
  cout << Min << endl;
  return 0;
}
