#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<long long>;
using VVL = vector<vector<long long>>;
using VP = vector<P>;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int n, ans;
VI abc, l;
const int INF = 1 << 20;
int f(int x, VI useL) {
  int cost = INF;
  int sz = useL.size();
  for (int i = 1; i < (1 << sz); i++) {
    VI used;
    for (int j = 0; j < (int)(sz); j++)
      if (i >> j & 1) used.push_back(j);
    int len = 0;
    int merge = 0;
    for (int j = 0; j < (int)(used.size()); j++) {
      if (j != 0) merge += 10;
      len += useL[j];
      cost = min(cost, abs(len - x) + merge);
    }
  }
  return cost;
}
void dfs(VI nums) {
  if ((int)nums.size() == n) {
    int sum = 0;
    for (int j = 0; j < 3; j++) {
      int x = abc[j];
      VI useL;
      for (int k = 0; k < n; k++) {
        if (nums[k] == j) useL.push_back(l[k]);
      }
      sum += f(x, useL);
    }
    ans = min(ans, sum);
  } else {
    for (int j = 0; j < 3; j++) {
      nums.push_back(j);
      dfs(nums);
      nums.pop_back();
    }
  }
}
int main() {
  cin >> n;
  abc.resize(3);
  l.resize(n);
  for (int i = 0; i < (int)(3); i++) cin >> abc[i];
  for (int i = 0; i < (int)(n); i++) cin >> l[i];
  ans = INF;
  dfs(VI(0));
  cout << ans << endl;
  return 0;
}
