#include <bits/stdc++.h>
using namespace std;
unsigned long long inf = (1LL << 62);
long long MOD = (long long)pow(10.0, 9.0) + 7;
pair<long long, long long> dx[4] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
char da[4] = {'R', 'L', 'D', 'U'};
char dax[4] = {-1, 1, -1, 1};
char dax2[4] = {1, -1, 1, -1};
long long min(long long a, long long b) { return (a < b) ? a : b; }
long long max(long long a, long long b) { return (a > b) ? a : b; }
vector<long long> l;
long long N, A, B, C;
long long dfs(int num, int curA, int curB, int curC, int point) {
  if (num == N) {
    if (curA == 0 || curB == 0 || curC == 0)
      return inf;
    else
      return point + abs(curA - A) + abs(curB - B) + abs(curC - C);
  }
  long long retval =
      dfs(num + 1, curA + l[num], curB, curC, point + 10 * (curA > 0));
  retval = min(dfs(num + 1, curA, curB + l[num], curC, point + 10 * (curB > 0)),
               retval);
  retval = min(dfs(num + 1, curA, curB, curC + l[num], point + 10 * (curC > 0)),
               retval);
  retval = min(dfs(num + 1, curA, curB, curC, point), retval);
}
int main() {
  cin >> N >> A >> B >> C;
  l.resize(N);
  for (int i = 0; i < (int)(N); i++) cin >> l[i];
  cout << dfs(0, 0, 0, 0, 0) << endl;
  return 0;
}
