#include <bits/stdc++.h>
using namespace std;
int N, A, B, C;
int l[8];
int DFS(int cur, int a, int b, int c) {
  if (cur == N - 1)
    return abs(a - A) + abs(b - B) + abs(c - C);
  else {
    int tmp1 = DFS(cur + 1, a, b, c);
    int tmp2 = DFS(cur + 1, a + l[cur], b, c) + 10;
    int tmp3 = DFS(cur + 1, a, b + l[cur], c) + 10;
    int tmp4 = DFS(cur + 1, a, b, c + l[cur]) + 10;
    return min(min(min(tmp1, tmp2), tmp3), tmp4);
  }
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }
  int ans = DFS(0, 0, 0, 0);
  cout << ans;
  return 0;
}
