#include <bits/stdc++.h>
using namespace std;
int m = 1000000;
int A, B, C, N;
int l[8];
void magic(int a, int b, int c, int n, int total) {
  if (a != 0 && b != 0 && c != 0) {
    m = min(abs(A - a) + abs(B - b) + abs(C - c) + total, m);
  }
  if (n > N) {
    return;
  }
  int aa = 0, bb = 0, cc = 0;
  if (a != 0) {
    aa += 10;
  }
  if (b != 0) {
    bb += 10;
  }
  if (c != 0) {
    cc += 10;
  }
  magic(a + l[n], b, c, n + 1, total + aa);
  magic(a, b + l[n], c, n + 1, total + bb);
  magic(a, b, c + l[n], n + 1, total + cc);
  magic(a, b, c, n + 1, total);
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    l[i] = tmp;
  }
  magic(l[0], 0, 0, 1, 0);
  magic(0, l[0], 0, 1, 0);
  magic(0, 0, l[0], 1, 0);
  magic(0, 0, 0, 1, 0);
  cout << m << endl;
}
