#include <bits/stdc++.h>
using namespace std;
int totalCost = -1;
int calCost(vector<int>& l, vector<int>& target, vector<int>& used) {
  int cost = 0;
  vector<int> sum(target.size(), -1);
  for (int i = 0; i < used.size(); ++i) {
    if (sum[used[i]] == -1) {
      sum[used[i]] = l[i];
    } else {
      sum[used[i]] += l[i];
      cost += 10;
    }
  }
  for (int i = 0; i < target.size(); ++i) {
    cost += abs(target[i] - sum[i]);
  }
  return cost;
}
void step(int s, int n, vector<int>& l, vector<int>& target,
          vector<int>& used) {
  if (s == n) {
    int cost = calCost(l, target, used);
    if (totalCost == -1) {
      totalCost = cost;
    } else {
      totalCost = min(totalCost, cost);
    }
    return;
  }
  for (int i = 0; i < 3; ++i) {
    used[s] = i;
    step(s + 1, n, l, target, used);
  }
}
int main(int argc, const char* argv[]) {
  int n = 0;
  vector<int> target(3, 0);
  cin >> n >> target[0] >> target[1] >> target[2];
  vector<int> l(n, 0);
  for (int i = 0; i < n; ++i) {
    cin >> l[i];
  }
  vector<int> used(n, -1);
  step(0, n, l, target, used);
  cout << totalCost << endl;
  return 0;
}
