#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A, B, C;
  int L[10];
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) cin >> L[i];
  vector<pair<int, int> > p;
  for (int bit = 0; bit < (1 << N); ++bit) {
    vector<int> S;
    for (int i = 0; i < N; ++i) {
      if (bit & (1 << i)) {
        S.push_back(L[i]);
      }
    }
    int sum = 0;
    for (int i = 0; i < (int)S.size(); ++i) {
      sum += S[i];
    }
    p.push_back(make_pair(sum, (int)S.size()));
  }
  sort(p.begin(), p.end());
  reverse(p.begin(), p.end());
  int mp = 0;
  for (int i = 0; i < (int)p.size(); ++i) {
    if (abs(A - p[i].first) < abs(A - p[i + 1].first)) {
      mp += (p[i].second - 1) * 10;
      mp += abs(A - p[i].first);
      p.erase(p.begin() + i);
      break;
    }
  }
  for (int i = 0; i < (int)p.size(); ++i) {
    if (abs(B - p[i].first) < abs(B - p[i + 1].first)) {
      mp += (p[i].second - 1) * 10;
      mp += abs(B - p[i].first);
      p.erase(p.begin() + i);
      break;
    }
  }
  for (int i = 0; i < (int)p.size(); ++i) {
    if (abs(C - p[i].first) < abs(C - p[i + 1].first)) {
      mp += (p[i].second - 1) * 10;
      mp += abs(C - p[i].first);
      p.erase(p.begin() + i);
      break;
    }
  }
  cout << mp << endl;
}
