#include <bits/stdc++.h>
using namespace std;
int N, A, B, C;
vector<int> l;
int dfs(int depth, int La, int Lb, int Lc) {
  if (depth == N + 1) {
    if (La > 0 && Lb > 0 && Lc > 0) {
      return abs(La - A) + abs(Lb - B) + abs(Lc - C) - 30;
    }
  } else {
    return 1e9;
  }
  int r1 = dfs(depth + 1, La + l[depth], Lb, Lc) + 10;
  int r2 = dfs(depth + 1, La, Lb + l[depth], Lc) + 10;
  int r3 = dfs(depth + 1, La, Lb, Lc + l[depth]) + 10;
  int r4 = dfs(depth + 1, La, Lb, Lc);
  return min(min(r1, r2), min(r3, r4));
}
int main() {
  cin >> N >> A >> B >> C;
  l.resize(N + 1);
  for (int i = 1; i <= N; i++) {
    cin >> l[i];
  }
  cout << dfs(1, 0, 0, 0) << endl;
  return 0;
}
