#include <bits/stdc++.h>
const int MOD = 1000000007, INF = 1111111111;
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  vector<int> G(3);
  cin >> N >> G[0] >> G[1] >> G[2];
  vector<int> len(N);
  for (int i = 0; i < N; i++) cin >> len[i];
  int cnt, tmp, notused, bitmp, out = INF;
  for (vector<int> idx({0, 1, 2}); next_permutation(idx.begin(), idx.end());) {
    vector<int> ans(3, INF);
    notused = (1 << N) - 1;
    for (int k = 0; k < 3; k++) {
      for (int i = 1; i < (1 << N); i++) {
        cnt = -1, tmp = 0;
        for (int j = 0; j < N; j++) {
          if (i & (1 << j) & notused) {
            cnt++;
            tmp += len[j];
          }
        }
        if (!tmp) continue;
        if (ans[idx[k]] > abs(tmp - G[idx[k]]) + cnt * 10) {
          ans[idx[k]] = abs(tmp - G[idx[k]]) + cnt * 10;
          bitmp = ~i;
        }
      }
      notused &= bitmp;
    }
    out = min(out, ans[0] + ans[1] + ans[2]);
  }
  cout << out << "\n";
  return 0;
}
