#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MAX_N = 8;
int N, A, B, C;
int l[MAX_N];
int dfs(int cur, int a, int b, int c) {
  if (cur == N) {
    int min = INF;
    for (int i = (0); i < (3); i++) {
      if (l[i] < min) min = l[i];
    }
    return min > 0 ? abs(a - A) + abs(b - B) + abs(c - C) - 30 : INF;
  }
  int ret0 = dfs(cur + 1, a, b, c);
  int ret1 = dfs(cur + 1, a + l[cur], b, c) + 10;
  int ret2 = dfs(cur + 1, a, b + l[cur], c) + 10;
  int ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10;
  int min = INF;
  int rets[4] = {ret0, ret1, ret2, ret3};
  for (int ret : rets) {
    if (ret < min) min = ret;
  }
  return min;
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = (0); i < (N); i++) {
    cin >> l[i];
  }
  cout << dfs(0, 0, 0, 0) << endl;
  return 0;
}
