#include <bits/stdc++.h>
using namespace std;
unsigned GetDigit(unsigned num) { return std::to_string(num).length(); }
int main(void) {
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  int ans = (int)(1123456789);
  vector<int> end;
  end.push_back(A);
  end.push_back(B);
  end.push_back(C);
  int l[N];
  for (int i = 0; i < (int)(N); i++) cin >> l[i];
  int max_cnt = std::pow(4, N);
  for (int i = 0; i < (int)(max_cnt); i++) {
    vector<vector<int> > assign;
    assign.resize(4);
    int cnt = i;
    for (int j = 0; j < (int)(N); j++) {
      assign[cnt % 4].push_back(l[j]);
      cnt = cnt / 4;
    }
    int cost = 0;
    for (int i = 0; i < (int)(3); i++) {
      cost += (assign[i].size() - 1) * 10;
      cost +=
          abs(end[i] - std::accumulate(assign[i].begin(), assign[i].end(), 0));
    }
    ans = min(ans, cost);
  }
  cout << ans << endl;
  return 0;
}
