#include <bits/stdc++.h>
using namespace std;
int N, A, B, C, m = INT_MAX;
vector<int> take;
int calc(vector<int> v) {
  int a = 0, b = 0, c = 0, mp = 0;
  for (int i = 0; i < N; i++) {
    if (v[i] == 0) {
      if (a > 0) {
        mp += 10;
      }
      a += take[i];
    } else if (v[i] == 1) {
      if (b > 0) {
        mp += 10;
      }
      b += take[i];
    } else if (v[i] == 2) {
      if (c > 0) {
        mp += 10;
      }
      c += take[i];
    }
  }
  mp += abs(A - a);
  mp += abs(B - b);
  mp += abs(C - c);
  return mp;
}
int dfs(int d, vector<int> v) {
  if (d == N) {
    return m = min(calc(v), m);
  }
  for (int i = 0; i < 4; i++) {
    v[d] = i;
    dfs(d + 1, v);
  }
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) {
    int l;
    cin >> l;
    take.push_back(l);
  }
  vector<int> v(N, 0);
  dfs(0, v);
  cout << m << endl;
}
