#include <bits/stdc++.h>
using namespace std;
int A, B, C, D, N;
vector<int> l;
int dfs(int depth, int LA, int LB, int LC) {
  if (depth == N) {
    if (LA == 0 || LB == 0 || LC == 0) {
      return INT_MAX;
    } else {
      return abs(LA - A) + abs(LB - B) + abs(LC - C) - 30;
    }
  }
  int ret1 = dfs(depth + 1, LA + l[depth], LB, LC) + 10;
  int ret2 = dfs(depth + 1, LA, LB + l[depth], LC) + 10;
  int ret3 = dfs(depth + 1, LA, LB, LC + l[depth]) + 10;
  int ret4 = dfs(depth + 1, LA, LB, LC);
  return min(min(ret1, ret2), min(ret3, ret4));
}
int main() {
  cin >> N >> A >> B >> C;
  l.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }
  cout << dfs(0, 0, 0, 0) << endl;
  return 0;
}
