#include <bits/stdc++.h>
using namespace std;
int dfs(int N, int cur, int a, int b, int c, int A, int B, int C, int* l) {
  if (cur == N) {
    if (min({a, b, c}) > 0)
      return abs(a - A) + abs(b - B) + abs(c - C) - 30;
    else
      return 1000000000;
    ;
  } else {
    int ret0 = dfs(N, cur + 1, a, b, c, A, B, C, l);
    int ret1 = dfs(N, cur + 1, a + l[cur], b, c, A, B, C, l) + 10;
    int ret2 = dfs(N, cur + 1, a, b + l[cur], c, A, B, C, l) + 10;
    int ret3 = dfs(N, cur + 1, a, b, c + l[cur], A, B, C, l) + 10;
    return min({ret0, ret1, ret2, ret3});
  }
}
int main() {
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  int l[N];
  for (int i = 0; i < N; i++) cin >> l[i];
  cout << dfs(N, 0, 0, 0, 0, A, B, C, l) << endl;
  ;
  return 0;
}
