#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const int INF = 1e9;
int main() {
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  vector<int> L(N);
  for (int i = 0; i < N; ++i) cin >> L[i];
  function<int(int, int, int, int)> rec = [&](int i, int a, int b, int c) {
    if (i == N) {
      if (a & b & c) return abs(a - A) + abs(b - B) + abs(c - C) - 30;
      return INF;
    }
    int res = rec(i + 1, a, b, c);
    chmin(res, rec(i + 1, a + L[i], b, c) + 10);
    chmin(res, rec(i + 1, a, b + L[i], c) + 10);
    chmin(res, rec(i + 1, a, b, c + L[i]) + 10);
    return res;
  };
  cout << rec(0, 0, 0, 0) << endl;
  return 0;
}
