#include <bits/stdc++.h>
using namespace std;
vector<int> l;
int n, a, b, c;
int minCost(int x, int y, int z, int i, int cost) {
  if (i == n) {
    if (cost < 0) return INT_MAX;
    return cost + abs(a - x) + abs(b - y) + abs(c - z);
  }
  int minA = minCost(x + l[i], y, z, i + 1, cost + 10);
  int minB = minCost(x, y + l[i], z, i + 1, cost + 10);
  int minC = minCost(x, y, z + l[i], i + 1, cost + 10);
  int minD = minCost(x, y, z, i + 1, cost);
  return min({minA, minB, minC, minD});
}
int main() {
  cin >> n >> a >> b >> c;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    l.push_back(tmp);
  }
  cout << minCost(0, 0, 0, 0, -30) << endl;
  return 0;
}
