#include <bits/stdc++.h>
using namespace std;
int n;
int a[3];
int h[10];
bool taken[10];
int go(int x) {
  int best = 1e5;
  int c1 = 1e5;
  int c2 = 1e5;
  int l = n, r = 0;
  for (int i = 0; i < n; i++) {
    int sum = 0, cnt = 0;
    for (int j = i; j < n; j++) {
      if (taken[j]) continue;
      sum += h[j];
      cnt++;
      int sofar = abs(sum - x) + (cnt - 1) * 10;
      if (sofar <= c2) {
        l = i;
        r = j;
        c2 = sofar;
      }
    }
  }
  for (int i = l; i <= r; i++) taken[i] = 1;
  return c2;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < 3; i++) {
    scanf("%d", &a[i]);
  }
  sort(a, a + 3);
  for (int i = 0; i < n; i++) {
    scanf("%d", &h[i]);
  }
  sort(h, h + n);
  vector<int> ord;
  ord.push_back(0);
  ord.push_back(1);
  ord.push_back(2);
  int ways = 1e5;
  do {
    memset(taken, 0, sizeof taken);
    cout << go(a[ord[0]]) + go(a[ord[1]]) + go(a[ord[2]]) << endl;
  } while (next_permutation(ord.begin(), ord.end()));
  printf("%d\n", ways);
}
