#include <bits/stdc++.h>
using namespace std;
int n, a, b, c;
int l[8];
int dfs(int now, int which[]) {
  if (now == n) {
    pair<int, int> tmp[4] = {pair<int, int>(0, 0)};
    for (int i = 0; i < n; ++i) {
      tmp[which[i]].first += l[i];
      tmp[which[i]].second++;
    }
    int res = 0;
    res += (tmp[0].second - 1) * 10 + (tmp[1].second - 1) * 10 +
           (tmp[2].second - 1) * 10;
    res +=
        abs(tmp[0].first - a) + abs(tmp[1].first - b) + abs(tmp[2].first - c);
    return res;
  }
  int res = (int)(1e9 + 7);
  for (int i = 0; i < 4; ++i) {
    which[now] = i;
    res = min(res, dfs(now + 1, which));
  }
  return res;
}
int main() {
  cin >> n >> a >> b >> c;
  for (int i = 0; i < n; ++i) cin >> l[i];
  int which[8] = {0};
  cout << dfs(0, which) << endl;
}
