#include <bits/stdc++.h>
using namespace std;
int N, A, B, C;
vector<int> bamboo;
int dfs(int depth, int a, int b, int c) {
  if (depth == N) {
    if (a == 0 && b == 0 && c == 0) return INT_MAX;
    return abs(A - a) + abs(B - b) + abs(C - c);
  }
  int ans = dfs(depth + 1, a, b, c);
  if (a >= 1) {
    ans = (min)({ans, dfs(depth + 1, a + bamboo[depth], b, c) + 10});
  } else
    ans = (min)({ans, dfs(depth + 1, a + bamboo[depth], b, c)});
  if (b >= 1) {
    ans = (min)({ans, dfs(depth + 1, a, b + bamboo[depth], c) + 10});
  } else
    ans = (min)({ans, dfs(depth + 1, a, b + bamboo[depth], c)});
  if (c >= 1) {
    ans = (min)({ans, dfs(depth + 1, a, b, c + bamboo[depth]) + 10});
  } else
    ans = (min)({ans, dfs(depth + 1, a, b, c + bamboo[depth])});
  return ans;
}
int main(void) {
  cin >> N >> A >> B >> C;
  bamboo.resize(N + 1);
  for (int i = 0; i < N; i++) {
    cin >> bamboo[i];
  }
  cout << dfs(0, 0, 0, 0) << endl;
}
