#include <bits/stdc++.h>
using namespace std;
const int INF = 100000;
int N, A, B, C;
int mem[10];
int DFS(int cur, int a, int b, int c) {
  if (cur == N) {
    if (min(a, min(b, c)) <= 0)
      return INF;
    else
      return abs(a - A) + abs(b - B) + abs(c - C) - 30;
  } else {
    int res0 = DFS(cur + 1, a + mem[cur], b, c) + 10;
    int res1 = DFS(cur + 1, a, b + mem[cur], c) + 10;
    int res2 = DFS(cur + 1, a, b, c + mem[cur]) + 10;
    int res3 = DFS(cur + 1, a, b, c) + 10;
    return min(res0, min(res1, min(res2, res3)));
  }
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) cin >> mem[i];
  printf("%d\n", DFS(0, 0, 0, 0));
}
