#include <bits/stdc++.h>
using namespace std;
long long factor[300];
long long memory[300];
void primefac(long long num) {
  int i = 0, kosuu = 0;
  while (*(factor + i) != 0) {
    while (num % *(factor + i) == 0) {
      num /= *(factor + i);
      memory[*(factor + i)] += 1;
    }
    if (num == 1) break;
    i++;
  }
}
int elast(long long number) {
  long long tmp = 0;
  int flag = 0;
  *factor = 2;
  for (int i = 3; i <= number; i++) {
    flag = 0;
    for (int j = 0; j <= tmp; j++) {
      if (i % (*(factor + j)) == 0) {
        flag = 1;
        break;
      }
    }
    if (flag) continue;
    tmp += 1;
    *(factor + tmp) = i;
  }
  return tmp + 2;
}
long long compare(const long long *a, const long long *b) {
  if (*a < *b)
    return -1;
  else if (*a > *b)
    return 1;
  return 0;
}
long long nCr(int n, int r) {
  long long val = 1;
  int i;
  if (r == 0) return 1;
  for (i = 0; i < n - r; i++) {
    val *= (n - i);
    val /= (i + 1);
  }
  return val;
}
long long nPr(int n, int r) {
  long long val = 1;
  int i;
  for (i = 0; i < r; i++) {
    val *= (n - i);
  }
  return val;
}
void chmin(long long &a, long long b) {
  if (a > b) a = b;
}
void chmax(long long &a, long long b) {
  if (a < b) a = b;
}
long long mp;
vector<long long> l(8, 0);
long long N, A, B, C;
long long dfs(long long i, long long a, long long b, long long c) {
  if (i == N) {
    if (!(a || b || c)) return 922337203600070000;
    return abs(a - A) + abs(b - B) + abs(c - C);
  }
  long long res = 922337203600070000;
  res = dfs(i + 1, a, b, c);
  chmin(res, dfs(i + 1, a, b + l[i], c) + (a != 0) * 10);
  chmin(res, dfs(i + 1, a, b + l[i], c) + (b != 0) * 10);
  chmin(res, dfs(i + 1, a, b, c + l[i]) + (c != 0) * 10);
  return res;
}
int main() {
  mp = 922337203600070000;
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }
  cout << dfs(0, 0, 0, 0) << endl;
  return 0;
}
