#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  int l[8] = {};
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }
  int length = pow(4, 8);
  int* sums = new int[length];
  int num = pow(4, N);
  for (int i = 0; i < num; i++) {
    int num_bk = i;
    int a, b, c;
    a = b = c = 0;
    int sum = 0;
    for (int j = 0; j < N; j++) {
      int mod = 0;
      switch (num_bk % 4) {
        case 0:
          break;
        case 1:
          if (a > 0) sum += 10;
          a += l[j];
          break;
        case 2:
          if (b > 0) sum += 10;
          b += l[j];
          break;
        case 3:
          if (c > 0) sum += 10;
          c += l[j];
          break;
      }
      num_bk /= 4;
    }
    sum += abs(a - A) + abs(b - B) + abs(c - C);
    sums[i] = sum;
  }
  int* min = std::min_element(sums, sums + num);
  cout << *min << endl;
  delete[] sums;
}
