#include <bits/stdc++.h>
using namespace std;
const static int MOD = 1000000000 + 7;
const static long long int INF = 1LL << 60;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};
int n, a, b, c;
vector<int> bamboo_length;
int get_sum(int l, int r) {
  int sum = 0;
  for (int i = l; i < r; ++i) {
    sum += bamboo_length[i];
  }
  return sum;
}
int main(int argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> a >> b >> c;
  bamboo_length.resize(n);
  for (size_t i = 0; i < n; ++i) cin >> bamboo_length[i];
  sort(bamboo_length.begin(), bamboo_length.end());
  int ans = 1000000000;
  do {
    for (int i = 0; i < n; ++i) {
      for (int j = i + 1; j < n; ++j) {
        for (int k = j + 1; k < n; ++k) {
          int len_a = 0, len_b = 0, len_c = 0, tmp_ans = 0;
          len_a = get_sum(0, i);
          len_b = get_sum(i, j);
          len_c = get_sum(j, k);
          if (len_a == 0 || len_b == 0 || len_c == 0) continue;
          tmp_ans = abs(a - len_a) + abs(b - len_b) + abs(c - len_c) +
                    20 * (i + j - i + k - j);
          ans = min(ans, tmp_ans);
        }
      }
    }
  } while (next_permutation(bamboo_length.begin(), bamboo_length.end()));
  cout << ans << endl;
  return 0;
}
