#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
}
vector<int> l;
int n;
int solve(int first, int second, int third) {
  int f_min = INT_MAX;
  int f_mask = 0;
  int s_min = INT_MAX;
  int s_mask = 0;
  int t_min = INT_MAX;
  int t_mask = 0;
  for (int bit = 1; bit < (1 << n); ++bit) {
    int tmp = 0;
    int cost = 0;
    for (long long i = 0; i < (long long)(n); ++i)
      if (bit & (1 << i)) {
        if (tmp > 0) cost += 10;
        tmp += l[i];
      }
    cost += abs(max(first, tmp) - min(first, tmp));
    if (f_min > cost) {
      f_min = cost;
      f_mask = bit;
    }
  }
  for (int bit = 1; bit < (1 << n); ++bit) {
    if (bit & f_mask) continue;
    int tmp = 0;
    int cost = 0;
    for (long long i = 0; i < (long long)(n); ++i)
      if (bit & (1 << i)) {
        if (tmp > 0) cost += 10;
        tmp += l[i];
      }
    cost += abs(max(second, tmp) - min(second, tmp));
    if (s_min > cost) {
      s_min = cost;
      s_mask = bit;
    }
  }
  for (int bit = 1; bit < (1 << n); ++bit) {
    if (bit & f_mask || bit & s_mask) continue;
    int tmp = 0;
    int cost = 0;
    for (long long i = 0; i < (long long)(n); ++i)
      if (bit & (1 << i)) {
        if (tmp > 0) cost += 10;
        tmp += l[i];
      }
    cost += abs(max(third, tmp) - min(third, tmp));
    if (t_min > cost) {
      t_min = cost;
      t_mask = bit;
    }
  }
  return f_min + s_min + t_min;
}
int main() {
  int a, b, c;
  cin >> n >> a >> b >> c;
  for (long long i = 0; i < (long long)(n); ++i) {
    int tmp;
    cin >> tmp;
    l.push_back(tmp);
  }
  int ans = INT_MAX;
  chmin(ans, solve(a, b, c));
  chmin(ans, solve(a, c, b));
  chmin(ans, solve(b, a, c));
  chmin(ans, solve(b, c, a));
  chmin(ans, solve(c, a, b));
  chmin(ans, solve(c, b, a));
  cout << ans << endl;
  return 0;
}
