#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<int> l(n);
  for (int i = 0; i < n; i++) {
    cin >> l.at(i);
  }
  int ans = 1e9;
  for (int s = 0; s < 1 << (2 * n); s++) {
    int lx[4] = {}, m[4] = {}, scopy = s;
    for (int i = 0; i < n; i++) {
      lx[scopy % 4] += l.at(i);
      m[scopy % 4]++;
      scopy /= 4;
    }
    if (m[0] == 0 or m[1] == 0 or m[2] == 0) continue;
    ans = min(ans, 10 * (m[0] + m[1] + m[2] - 3) + abs(lx[0] - a) + abs(lx[1] - b) + abs(lx[2] - c));
  }
  cout << ans << endl;
}
