#include <bits/stdc++.h>
using namespace std;
int chofuku(vector<int> Bin) {
  sort(Bin.begin(), Bin.end());
  int n = Bin.size();
  int ans = 0;
  for (int i = 1; i < n; i++) {
    if (Bin[i] == Bin[i - 1] && Bin[i] > 0) ans++;
  }
  return ans;
}
int main() {
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  vector<int> l(N);
  for (int i = 0; i < N; i++) cin >> l[i];
  int ans = 1000000000;
  int max_i = pow(4, N);
  for (int i = 0; i < max_i; i++) {
    vector<int> Bin(N);
    vector<int> Ans(4, 0);
    int gousei = 0;
    for (int j = 0; j < N; j++) {
      Bin[j] = (i >> (2 * j)) & 3;
      Ans[Bin[j]] += l[j];
      gousei = chofuku(Bin);
    }
    int ans1 = abs(Ans[1] - A);
    int ans2 = abs(Ans[2] - B);
    int ans3 = abs(Ans[3] - C);
    ans = min(ans1 + ans2 + ans3 + gousei * 10, ans);
  }
  cout << ans << endl;
}
