#include <bits/stdc++.h>
using namespace std;
int bamboo[10], len, minn, n;
void hs(int sum, int l, int k, int v, int s) {
  int i;
  minn = min(minn, s + abs(sum - v));
  if (k == l + 1) return;
  for (i = 1; i <= n; i++) {
    if (bamboo[i] == -1) continue;
    sum -= bamboo[i];
    s -= 10;
    hs(sum, l - 1, k + 1, v, s);
    s += 10;
    sum += bamboo[i];
  }
}
int main() {
  int a, b, c, i, j, ans = 0, sum;
  scanf("%d%d%d%d", &n, &a, &b, &c);
  len = n;
  for (i = 1; i <= n; i++) {
    scanf("%d", &bamboo[i]);
    if (bamboo[i] == a) {
      bamboo[i] = -1;
      a = -1;
      len--;
    } else if (bamboo[i] == b) {
      bamboo[i] = -1;
      b = -1;
      len--;
    } else if (bamboo[i] = c) {
      bamboo[i] = -1;
      c = -1;
      len--;
    }
  }
  if (a != -1) {
    sum = 0;
    minn = INT_MAX;
    for (i = 1; i <= n; i++) sum += (bamboo[i] != -1 ? bamboo[i] : 0);
    hs(sum, len, 1, a, len * 10 - 10);
    ans += minn;
  }
  if (b != -1) {
    sum = 0;
    minn = INT_MAX;
    for (i = 1; i <= n; i++) sum += (bamboo[i] != -1 ? bamboo[i] : 0);
    hs(sum, len, 1, b, len * 10 - 10);
    ans += minn;
  }
  if (c != -1) {
    sum = 0;
    minn = INT_MAX;
    for (i = 1; i <= n; i++) sum += (bamboo[i] != -1 ? bamboo[i] : 0);
    hs(sum, len, 1, c, len * 10 - 10);
    ans += minn;
  }
  printf("%d", ans);
  return 0;
}
