#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<int> l(n);
  for (int i = 0; i < (n); ++i) cin >> l[i];
  int res = 1001001001;
  for (int i = 0; i < (1 << n); ++i) {
    for (int j = 0; j < (1 << n); ++j) {
      for (int k = 0; k < (1 << n); ++k) {
        vector<int> use_a(n, 0), use_b(n, 0), use_c(n, 0);
        int cnt_a = 0;
        int cnt_b = 0;
        int cnt_c = 0;
        for (int d = 0; d < (n); ++d) {
          if (i & (1 << d)) {
            use_a[d] = 1;
            ++cnt_a;
          }
          if (j & (1 << d)) {
            use_b[d] = 1;
            ++cnt_b;
          }
          if (k & (1 << d)) {
            use_c[d] = 1;
            ++cnt_c;
          }
        }
        bool ng = false;
        for (int d = 0; d < (n); ++d) {
          if (use_a[d] + use_b[d] + use_c[d] > 1) ng = true;
        }
        if (ng) continue;
        int cost_a = 10 * (cnt_a - 1);
        int cost_b = 10 * (cnt_b - 1);
        int cost_c = 10 * (cnt_c - 1);
        int len_a = 0;
        int len_b = 0;
        int len_c = 0;
        for (int d = 0; d < (n); ++d) {
          len_a += l[d] * use_a[d];
          len_b += l[d] * use_b[d];
          len_c += l[d] * use_c[d];
        }
        res = min(res, abs(a - len_a) + cost_a + abs(b - len_b) + cost_b +
                           abs(c - len_c) + cost_c);
      }
    }
  }
  cout << res << endl;
  return 0;
}
