#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main(void) {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  vector<long long> x(3);
  cin >> n >> x[0] >> x[1] >> x[2];
  vector<long long> l(n);
  for (long long i = 0; i < (long long)n; ++i) cin >> l[i];
  long long ans = 10e12;
  for (long long i = 0; i < (long long)pow(4, n); ++i) {
    long long tmp = i;
    vector<vector<long long>> v(4);
    long long cta = 0;
    while (tmp != 0) v[tmp % 4].push_back(cta), tmp /= 4, cta++;
    if (v[0].size() == 0) continue;
    if (v[1].size() == 0) continue;
    if (v[2].size() == 0) continue;
    long long cost = 0, res = 0;
    for (long long j = 0; j < (long long)3; ++j) {
      res = 0;
      for (auto k : v[j]) res += l[k];
      cost += abs(x[j] - res) + 10 * (v[j].size() - 1);
    }
    ans = min(ans, cost);
  }
  cout << ans << endl;
}
