#include <bits/stdc++.h>
using namespace std;
constexpr auto INF = INT_MAX / 2;
constexpr auto MOD = 1000000007;
int main() {
  int n;
  vector<int> L(3);
  cin >> n >> L[0] >> L[1] >> L[2];
  vector<int> l(n);
  for (int i = 0; i < (n); i++) cin >> l[i];
  sort((l).begin(), (l).end());
  for (int i = 0; i < (3); i++) l.push_back(INF + i);
  int ans = INF;
  do {
    vector<vector<int>> leng(3, vector<int>(0));
    int k = 0;
    for (int i = 0; i < (3); i++) {
      while (k < n + 3) {
        if (l[k] != INF) leng[i].push_back(l[k]);
        k++;
        if (l[k - 1] == INF) break;
      }
    }
    if (leng[0].size() * leng[1].size() * leng[2].size() == 0) continue;
    vector<int> sum(3, 0);
    for (int i = 0; i < (3); i++)
      for (int j = 0; j < (leng[i].size()); j++) sum[i] += leng[i][j];
    int mp = 0;
    for (int i = 0; i < (3); i++)
      mp += 10 * leng[i].size() - 10 + abs(sum[i] - L[i]);
    ans = min(ans, mp);
  } while (next_permutation((l).begin(), (l).end()));
  cout << ans << endl;
}
