#include <bits/stdc++.h>
using namespace std;
int N, A, B, C;
int l[int(1e4)];
int dfs(int n, int a, int b, int c) {
  int ret[4] = {};
  if (n == N) {
    int o = 0;
    if (a != 0) o += 10;
    if (b != 0) o += 10;
    if (c != 0) o += 10;
    return abs(A - a) + abs(B - b) + abs(C - c) - o;
  }
  ret[0] = dfs(n + 1, a, b, c);
  ret[1] = dfs(n + 1, a + l[n], b, c) + 10;
  ret[2] = dfs(n + 1, a, b + l[n], c) + 10;
  ret[3] = dfs(n + 1, a, b, c + l[n]) + 10;
  return *min_element(ret, ret + 4);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N >> A >> B >> C;
  for (int n = 0; n < N; n++) cin >> l[n];
  cout << dfs(0, 0, 0, 0) << "\n";
  ;
  return 0;
}
