#include <bits/stdc++.h>
using namespace std;
vector<string> bit;
vector<int> l(8);
int N, A, B, C;
bool used[8];
int solve(int target, int no) {
  if (used[no] == true) {
    if (no >= N) return 10000;
    return solve(target, no + 1);
  }
  if (abs(target - l[no]) < 10 || no >= N) {
    used[no] = true;
    return abs(target - l[no]);
  }
  int a = solve(target, no + 1);
  int b = 10 + solve(target - l[no], no + 1);
  if (a >= b) {
    used[no] = true;
    return b;
  } else {
    used[no] = false;
    return a;
  }
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) cin >> l[i];
  int a[6];
  for (int i = 0; i < N; i++) used[i] = false;
  a[0] = solve(A, 0) + solve(B, 0) + solve(C, 0);
  for (int i = 0; i < N; i++) used[i] = false;
  a[1] = solve(A, 0) + solve(C, 0) + solve(B, 0);
  for (int i = 0; i < N; i++) used[i] = false;
  a[2] = solve(B, 0) + solve(A, 0) + solve(C, 0);
  for (int i = 0; i < N; i++) used[i] = false;
  a[3] = solve(B, 0) + solve(C, 0) + solve(A, 0);
  for (int i = 0; i < N; i++) used[i] = false;
  a[4] = solve(C, 0) + solve(A, 0) + solve(B, 0);
  for (int i = 0; i < N; i++) used[i] = false;
  a[5] = solve(C, 0) + solve(B, 0) + solve(A, 0);
  int ans = 100000;
  for (int i = 0; i < 6; i++) {
    if (ans > a[i]) ans = a[i];
  }
  cout << ans << endl;
}
