#include <bits/stdc++.h>
using namespace std;
int N, A, B, C;
int seq[4] = {0, 1, 2, 3};
int ANS = 100000;
int calcMP(vector<int> m) {
  if (m[1] == 0 || m[2] == 0 || m[3] == 0) return 10000;
  return abs(A - m[1]) + abs(B - m[2]) + abs(C - m[3]);
}
int dfs(int depth, int l[], vector<int> m, int mp) {
  if (depth == 0) {
    mp += calcMP(m);
    return mp;
  }
  for (auto s : seq) {
    int tmp = mp;
    vector<int> mm = m;
    if (mm[s] == 0) {
      mm[s] = l[depth - 1];
    } else {
      mm[s] += l[depth - 1];
      if (s != 0) tmp += 10;
    }
    tmp = dfs(depth - 1, l, mm, tmp);
    ANS = min(ANS, tmp);
  }
  return ANS;
}
int main() {
  cin >> N >> A >> B >> C;
  int l[N];
  for (long long i = 0; i < (long long)(N); i++) cin >> l[i];
  int mp = 0;
  vector<int> m(N, 0);
  dfs(N, l, m, mp);
  cout << ANS;
}
