#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  int A, B, C;
  cin >> N >> A >> B >> C;
  vector<int> l(N);
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }
  int size = 1;
  for (int i = 0; i < N; i++) {
    size *= 4;
  }
  int ans = INT_MAX;
  for (int i = 0; i < size; i++) {
    int A_temp = 0;
    int B_temp = 0;
    int C_temp = 0;
    int MPsum = 0;
    for (int k = 0; k < N; k++) {
      int ABCjudge = i;
      for (int l = 0; l < k; l++) {
        ABCjudge /= 4;
      }
      ABCjudge %= 4;
      if (ABCjudge == 1) {
        if (A_temp > 0) {
          MPsum += 10;
        }
        A_temp += l[k];
      } else if (ABCjudge == 2) {
        if (B_temp > 0) {
          MPsum += 10;
        }
        B_temp += l[k];
      } else if (ABCjudge == 3) {
        if (C_temp > 0) {
          MPsum += 10;
        }
        C_temp += l[k];
      }
    }
    MPsum += abs(A - A_temp);
    MPsum += abs(B - B_temp);
    MPsum += abs(C - C_temp);
    if (MPsum < ans && A_temp != 0 && B_temp != 0 && C_temp != 0) {
      ans = MPsum;
    }
  }
  cout << ans << endl;
  return 0;
}
