#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 29;
int N, A, B, C;
vector<int> l;
int dfs(int depth, int LA, int LB, int LC) {
  if (depth == N) {
    if (LA > 0 && LB > 0 && LC > 0) {
      return abs(A - LA) + abs(B - LB) + abs(C - LC) - 30;
    } else {
      return inf;
    }
  } else {
    int c1 = dfs(depth + 1, LA + l[depth], LB, LC) + 10;
    int c2 = dfs(depth + 1, LA, LB + l[depth], LC) + 10;
    int c3 = dfs(depth + 1, LA, LB, LC + l[depth]) + 10;
    int c4 = dfs(depth + 1, LA, LB, LC) + 10;
    return min(min(c1, c2), (c3, c4));
  }
}
int main() {
  cin >> N >> A >> B >> C;
  l.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }
  cout << dfs(0, 0, 0, 0) << endl;
  return 0;
}
