#include <bits/stdc++.h>
using namespace std;
int n, a[3], l[8], ans = 100000;
int func3(vector<int>& v2, vector<int>& v4, int id) {
  if (id == v4.size()) {
    int sum = 0;
    for (int i = 0; i < v4.size(); i++) {
      if (v4[i] == 1) sum++;
    }
    if (sum != 3) return 100000;
    int ret = 0;
    for (int i = 0; i < v4.size(); i++) {
      if (v4[i] == 1) ret += v2[i];
    }
    return abs(a[0] + a[1] + a[2] - ret);
  }
  v4[id] = 0;
  int ret1 = func3(v2, v4, id + 1);
  v4[id] = 1;
  int ret2 = func3(v2, v4, id + 1);
  v4[id] = 0;
  return min(ret1, ret2);
}
void func2(vector<int>& v) {
  int maxi = 0;
  for (int i = 0; i < v.size(); i++) {
    maxi = max(v[i], maxi);
  }
  if (maxi < 2) return;
  vector<int> v2(maxi + 1, 0);
  for (int i = 0; i < v.size(); i++) {
    v2[v[i]] += l[i];
  }
  int anst = (n - (maxi + 1)) * 10;
  vector<int> v4(v2.size(), 0);
  anst += func3(v2, v4, 0);
  ans = min(anst, ans);
  return;
}
void func(vector<int>& v) {
  if (v.size() == n) {
    func2(v);
    return;
  }
  int maxv = 0;
  for (int i = 0; i < v.size(); i++) {
    maxv = max(v[i], maxv);
  }
  for (int i = 0; i <= maxv + 1; i++) {
    v.push_back(i);
    func(v);
    v.pop_back();
  }
  return;
}
void solve() {
  cin >> n >> a[0] >> a[1] >> a[2];
  for (int i = 0; i < n; i++) cin >> l[i];
  vector<int> v;
  v.push_back(0);
  func(v);
  cout << ans << endl;
  return;
}
int main() {
  solve();
  return 0;
}
