#include <bits/stdc++.h>
using namespace std;

int N, A, B, C;
vector<int> l;

int Dfs(int now, int a, int b, int c) {
  if (now == N) {
    if (min(min(a, b), c) > 0) return abs(a - A) + abs(b - B) + abs(c - C) - 30;
    else return 1000000000;
  }

  int cost0 = Dfs(now + 1, a, b, c);
  int cost1 = Dfs(now + 1, a + l[now], b, c) + 10;
  int cost2 = Dfs(now + 1, a, b + l[now], c) + 10;
  int cost3 = Dfs(now + 1, a, b, c + l[now]) + 10;

  return min(min(min(cost0, cost1), cost2), cost3);
}

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;
}