#include <bits/stdc++.h>
using namespace std;
int n, a, b, c;
int ans = 1e9 + 7;
int kado[8];
vector<vector<int>> use;
void solve(int i = 0) {
  if (i == n) {
    if (use[1].size() == 0 || use[2].size() == 0 || use[3].size() == 0) {
      return;
    } else {
      int kl[4] = {0};
      for (int j = 1; j < 4; j++) {
        for (int k = 0; k < use[i].size(); k++) {
          kl[j] += use[j][k];
        }
      }
      int sub = 10 * (use[1].size() + use[2].size() + use[3].size() - 3) +
                abs(a - kl[1]) + abs(b - kl[2]) + abs(c - kl[3]);
      ans = min(ans, sub);
    }
  } else {
    for (int j = 0; j < 4; j++) {
      use[j].push_back(kado[i]);
      solve(i + 1);
      use[j].pop_back();
    }
  }
  return;
}
int main() {
  cin >> n >> a >> b >> c;
  for (int i = 0; i < n; i++) {
    cin >> kado[i];
  }
  solve();
  cout << ans << endl;
  return 0;
}
