#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[3];
  cin >> n >> a[0] >> a[1] >> a[2];
  int l[n];
  for (int i = 0; i < n; i++) cin >> l[i];
  int ans = 99999;
  for (int i = 0; i < pow(4, n); i++) {
    vector<int> v[3];
    int t = i, c = 0;
    while (t > 0) {
      if (t % 4 < 3) v[t % 4].push_back(l[c]);
      t /= 4;
      c++;
    }
    if (min({v[0].size(), v[1].size(), v[2].size()}) == 0) continue;
    int cost = 0;
    for (int j = 0; j < 3; j++) {
      cost += (v[j].size() - 1) * 10;
      int sum = 0;
      for (int k = 0; k < v[j].size(); k++) sum += v[j][k];
      cost += abs(sum - a[j]);
    }
    ans = min(ans, cost);
  }
  cout << ans << endl;
  return 0;
}
