#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  array<int, 3> a;
  for (auto& e : a) cin >> e;
  vector<int> L(n);
  for (auto& e : L) cin >> e;
  int res = 1 << 30;
  for (int i = 0; i < (1 << (2 * n)); ++i) {
    array<int, 3> sum = {}, cnt = {};
    for (int j = 0; j < n; ++j) {
      int m = (i >> (2 * j)) & 3;
      if (m == 3) continue;
      sum[m] += L[j];
      cnt[m]++;
    }
    int cost = 0;
    for (int j = 0; j < 3; ++j) {
      cost += abs(sum[j] - a[j]);
      if (cnt[j] > 1) cost += 10 * (cnt[j] - 1);
    }
    res = min(res, cost);
  }
  cout << res << endl;
}
