#include <bits/stdc++.h>
using namespace std;
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, a, b, c, t;
  vector<int> v;
  int res = 0;
  cin >> n >> a >> b >> c;
  for (int i = 0; i < n; i++) {
    cin >> t;
    v.push_back(t);
  }
  sort(v.begin(), v.end());
  vector<int> l = {c, b, a};
  for (int i = 0; i < l.size(); i++) {
    int mp = 100000000;
    vector<int> temp;
    int m = v.size();
    for (int j = 1; j < (1 << m); j++) {
      int sum = 0;
      int spell = 0;
      vector<int> sel;
      for (int k = 0; k < m; k++) {
        if (j & (1 << k)) {
          spell++;
          sum += v[k];
          sel.push_back(k);
        }
      }
      int mpp = abs(sum - l[i]) + (spell - 1) * 10;
      if (mpp < mp) {
        mp = mpp;
        temp = sel;
      }
    }
    res += mp;
    for (int j = temp.size() - 1; j >= 0; j--) {
      v.erase(v.begin() + temp[j]);
    }
  }
  cout << res << '\n';
  return 0;
}
