#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 best_i = 0, best_j = 0, best_k = 0;
int use_a[8] = {0};
int find_best2() {
  int res = INT_MAX;
  int i, j, k;
  for (i = 1; i < pow(4, n); ++i) {
    int carry = 1;
    for (int y = 0; y < n; y++) {
      use_a[y] += carry;
      if (use_a[y] > 3) {
        use_a[y] = 0;
        carry = 1;
      } else {
        carry = 0;
      }
    }
    int ca = 0, cb = 0, cc = 0, lena = 0, lenb = 0, lenc = 0;
    for (int x = 0; x < n; ++x) {
      if (use_a[x] == 1) {
        lena += ls[x];
        ca++;
      } else if (use_a[x] == 2) {
        lenb += ls[x];
        cb++;
      } else if (use_a[x] == 3) {
        lenc += ls[x];
        cc++;
      }
    }
    int cost = ((a > lena) ? a - lena : lena - a) + 10 * (ca - 1);
    cost += ((b > lenb) ? b - lenb : lenb - b) + 10 * (cb - 1);
    cost += ((c > lenc) ? c - lenc : lenc - c) + 10 * (cc - 1);
    if (cost < res) {
      res = cost;
    }
  }
  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);
  }
  return 0;
}
