#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
int INF = 10000;
int N, A, B, C;
int dfs(int now, int a, int b, int c, std::vector<int> l) {
  if (now == N) {
    if (std::min({a, b, c}) > 0) {
      return abs(A - a) + abs(B - b) + abs(C - c) - 30;
    } else
      return INF;
  } else {
    int res0 = dfs(now + 1, a, b, c, l);
    int res1 = dfs(now + 1, a + l[now], b, c, l) + 10;
    int res2 = dfs(now + 1, a, b + l[now], c, l) + 10;
    int res3 = dfs(now + 1, a, b, c + l[now], l) + 10;
    return std::min({res0, res1, res2, res3});
  }
}
int main() {
  cin >> N >> A >> B >> C;
  std::vector<int> l(N);
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }
  cout << dfs(0, 0, 0, 0, l) << endl;
}
