#include <bits/stdc++.h>
using namespace std;
int N, M, K, A, B, C, ans = 0, cnt = 0, ret_0, ret_1, ret_2, ret_3;
string S, T;
vector<int> P, Q;
vector<pair<int, int>> PP;
bool CAN = false;
int dfs(int n, int a, int b, int c) {
  if (n == 0) {
    if (a == 0 && b == 0 && c == 0)
      return 0;
    else
      return ((1LL << 62) - (1LL << 31));
  }
  ret_0 = dfs(n - 1, a, b, c);
  ret_1 = dfs(n - 1, a - P.at(n), b, c) + 10;
  ret_2 = dfs(n - 1, a, b - P.at(n), c) + 10;
  ret_3 = dfs(n - 1, a, b, c - P.at(n)) + 10;
  if (n != N)
    return min(ret_0, min(ret_1, min(ret_2, ret_3)));
  else if (n == N)
    return min(ret_0, min(ret_1, min(ret_2, ret_3))) + abs(a - A) + abs(b - B) +
           abs(c - C);
}
int main() {
  cin >> N >> A >> B >> C;
  P.push_back(0);
  for (int i = (0); i < (N); ++i) {
    int h;
    cin >> h;
    P.push_back(h);
  }
  dfs(N, A, B, C);
}
