#include <bits/stdc++.h>
using namespace std;
int n, a, b, c;
vector<int> l;
int hoge(vector<int>& vi, int x) {
  int min_dist = 1e9;
  int min_index = -1;
  for (int i = (0); i < (vi.size()); i++) {
    if (min_dist > abs(vi[i] - x)) {
      min_dist = abs(vi[i] - x);
      min_index = i;
    }
  }
  vi.erase(vi.begin() + min_index);
  return min_dist;
}
int rec(vector<int> ll = l) {
  int res = 0;
  vector<int> cp_ll(ll);
  for (auto& x : {a, b, c}) {
    res += hoge(cp_ll, x);
  }
  if (ll.size() > 3) {
    for (int i = (0); i < (ll.size()); i++) {
      for (int j = (i + 1); j < (ll.size()); j++) {
        cp_ll = ll;
        cp_ll.push_back(cp_ll[i] + cp_ll[j]);
        cp_ll.erase(cp_ll.begin() + j);
        cp_ll.erase(cp_ll.begin() + i);
        res = min(res, 10 + rec(cp_ll));
      }
    }
  }
  return res;
}
int main() {
  cin >> n >> a >> b >> c;
  l.resize(n);
  for (int i = (0); i < (n); i++) cin >> l[i];
  cout << rec() << endl;
  return 0;
}
