#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
int dy[] = {1, 0, -1, 0, 1, -1, 1, -1};
long long fix_mod(long long x, long long y) { return (y + x % y) % y; }
void fast() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}
int main() {
  fast();
  int n;
  int a, b, c;
  cin >> n >> a >> b >> c;
  vector<int> v(n), vv;
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  int ans = INT_MAX, mn;
  vector<int> vx;
  for (int k = 7; k < (1 << n); k++) {
    vx.clear();
    int m = k;
    for (int j = 0; j < n; j++) {
      if (m & 1) vx.push_back(v[j]);
      m >>= 1;
    }
    if (vx.size() < 3) continue;
    do {
      vv = vx;
      for (int i = 1; i < vx.size(); i++) vv[i] += vv[i - 1];
      for (int i = 0; i < vv.size() - 2; i++) {
        if (a < i + 1) continue;
        for (int j = i + 1; j < vv.size() - 1; j++) {
          if (b < j - i || c < vx.size() - 1 - j) continue;
          mn = 0;
          mn += abs(vv[i] - a) + abs(vv[j] - vv[i] - b) +
                abs(vv[vx.size() - 1] - vv[j] - c);
          mn += (int)ceil(log2(i + 1)) * 10 + (int)ceil(log2(j - i)) * 10 +
                (int)ceil(log2(vx.size() - 1 - j)) * 10;
          ans = min(ans, mn);
        }
      }
    } while (next_permutation(vx.begin(), vx.end()));
    vv.clear();
  }
  return cout << ans << "\n", 0;
  ;
}
