#include <bits/stdc++.h>
using namespace std;
int n, a, b, c;
int ls[8];
int use = 0;
void printb(int v) {
  unsigned int mask = (int)1 << (sizeof(v) * CHAR_BIT - 1);
  do putchar(mask & v ? '1' : '0');
  while (mask >>= 1);
}
int find_best(int a) {
  int res = INT_MAX, best_i = 0;
  int i;
  for (i = 1; i < pow(2, n); ++i) {
    int c = 0, len = 0;
    if (i & use) continue;
    for (int j = 0; j < n; ++j) {
      if (i & 1 << j) {
        len += ls[j];
        c++;
      }
    }
    int cost = ((a > len) ? a - len : len - a) + 10 * (c - 1);
    if (cost < res) {
      best_i = i;
      res = cost;
    }
  }
  use = use | best_i;
  return res;
}
int main(int argc, char *argv[]) {
  scanf("%d %d %d %d", &n, &a, &b, &c);
  for (int i = 0; i < n; ++i) {
    scanf("%d", ls + i);
  }
  int t1 = find_best(a) + find_best(b) + find_best(c);
  use = 0;
  int t2 = find_best(b) + find_best(c) + find_best(a);
  use = 0;
  int t3 = find_best(c) + find_best(a) + find_best(b);
  use = 0;
  int t4 = find_best(a) + find_best(c) + find_best(b);
  use = 0;
  int t5 = find_best(b) + find_best(a) + find_best(c);
  use = 0;
  int t6 = find_best(c) + find_best(b) + find_best(a);
  printf("%d\n", min(t1, min(t2, min(t3, min(t4, min(t5, t6))))));
  return 0;
}
