#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
int calc(int num, vector<int> &vec) {
  int sum = 0;
  for (int i = 0; i < (int)vec.size(); i++) {
    sum += vec[i];
  }
  return max(0, (int)vec.size() - 1) * 10 + abs(num - sum);
}
int bit_count(int num) {
  int res = 0;
  for (int i = 0; i < 16; i++) {
    if ((num & (1 << i)) != 0) res++;
  }
  return res;
}
int main() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<int> bamboo(n);
  for (auto &e : bamboo) cin >> e;
  int min_cost = INF;
  for (int t = 0; t < (1 << (n * 2)); t++) {
    int cost = 0;
    vector<int> sa, sb, sc;
    for (int i = 0; i < n; i++) {
      int ind = t & (3 << (i * 2));
      ind = ind >> (i * 2);
      if (ind == 1)
        sa.push_back(bamboo[i]);
      else if (ind == 2)
        sb.push_back(bamboo[i]);
      else if (ind == 3)
        sc.push_back(bamboo[i]);
    }
    cost += calc(a, sa);
    cost += calc(b, sb);
    cost += calc(c, sc);
    min_cost = min(min_cost, cost);
  }
  cout << min_cost << endl;
}
