#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int answer = INT_MAX;
int N;
vector<int> abc(3);
vector<pair<int, int> > unit(4, pair<int, int>(0, 0));
void dfs(int depth, vector<int> &l) {
  if (depth < N) {
    for (int i = 0; i < (4); ++i) {
      unit[i].first += l[depth];
      unit[i].second += 1;
      dfs(depth + 1, l);
      unit[i].first -= l[depth];
      unit[i].second -= 1;
    }
  } else {
    int tmp = 0;
    for (int i = 0; i < (3); ++i) {
      if (unit[i].second == 0) return;
      tmp += abs(unit[i].first - abc[i]) + 10 * (unit[i].second - 1);
    }
    answer = min(answer, tmp);
  }
}
int main() {
  cin >> N;
  vector<int> l(N);
  for (int i = 0; i < (3); ++i) {
    cin >> abc[i];
  }
  for (int i = 0; i < (N); ++i) cin >> l[i];
  dfs(0, l);
  cout << answer << endl;
  return 0;
}
