#include <bits/stdc++.h>
using namespace std;
struct info {
  int point;
  vector<int> indexes;
};
vector<info> all_sum(vector<int> list) {
  vector<info> sums;
  for (int b = 1; b < 1 << (list.size()); b++) {
    int sum = 0;
    vector<int> indexes;
    for (int i = 0; i < list.size(); i++) {
      if (b & (1 << i)) {
        sum += list[i];
        indexes.push_back(i);
      }
    }
    sums.push_back({sum, indexes});
  }
  return sums;
}
int main() {
  int N;
  int point = 0;
  int wants[3];
  bool check[3] = {};
  cin >> N >> wants[2] >> wants[1] >> wants[0];
  vector<int> bamboo;
  for (int i = 0; i < N; i++) {
    int l;
    cin >> l;
    bamboo.push_back(l);
    for (int j = 0; j < 3; j++) {
      if (!check[j] && wants[j] == l) {
        check[j] = true;
        bamboo.erase(bamboo.end() - 1);
        break;
      }
    }
  }
  sort(bamboo.begin(), bamboo.end());
  reverse(bamboo.begin(), bamboo.end());
  for (int i = 0; i < 3; i++) {
    if (check[i]) {
      continue;
    }
    vector<info> sums = all_sum(bamboo);
    info best_info = {1000000, vector<int>()};
    for (int j = 0; j < sums.size(); j++) {
      int sub = abs(wants[i] - sums[j].point);
      if (sub < abs(wants[i] - best_info.point)) {
        best_info = sums[j];
      }
    }
    reverse(best_info.indexes.begin(), best_info.indexes.end());
    for (int j = 0; j < best_info.indexes.size(); j++) {
      bamboo.erase(bamboo.begin() + best_info.indexes[j]);
    }
    check[i] = true;
    point += abs(wants[i] - best_info.point);
    point += (best_info.indexes.size() - 1) * 10;
  }
  cout << point << endl;
  return 0;
}
