#include <bits/stdc++.h>
using namespace std;
int N, A, B, C;
vector<int> L;
int mp(int level, int a, int b, int c) {
  if (level == N) {
    if (a == 0 || b == 0 || c == 0) {
      return 1000000;
    } else {
      return abs(a - A) + abs(b - B) + abs(c - C);
    }
  }
  int ret_a = mp(level + 1, a + L[level], b, c) + (a == 0) ? 0 : 10;
  int ret_b = mp(level + 1, a, b + L[level], c) + (b == 0) ? 0 : 10;
  int ret_c = mp(level + 1, a, b, c + L[level]) + (c == 0) ? 0 : 10;
  int ret_null = mp(level + 1, a, b, c);
  return min(min(min(ret_a, ret_b), ret_c), ret_null);
}
int main(int argc, char* argv[]) {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) {
    int l;
    cin >> l;
    L.push_back(l);
  }
  cout << mp(0, 0, 0, 0) << endl;
  return 0;
}
