#include <bits/stdc++.h>
using namespace std;
const long MOD = 1000000007;
int make(vector<int> l, int g) {
  sort(l.begin(), l.end());
  int ret = 1000000009;
  do {
    for (int i = 1; i <= l.size(); i++) {
      int sum = 0;
      for (int j = 0; j < i; j++) {
        sum += l[j];
      }
      ret = min(ret, 10 * (i - 1) + abs(g - sum));
    }
  } while (next_permutation(l.begin(), l.end()));
  return ret;
}
int main() {
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  int l[N];
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }
  sort(l, l + N);
  int ans = 1000000005;
  do {
    for (int a = 1; a <= N - 2; a++) {
      for (int b = 1; b <= N - 2; b++) {
        int c = N - a - b;
        if (c <= 0) continue;
        vector<int> l2;
        for (int i = 0; i < a; i++) {
          l2.push_back(l[i]);
        }
        int ta = make(l2, A);
        l2.clear();
        for (int i = a; i < a + b; i++) {
          l2.push_back(l[i]);
        }
        ta += make(l2, B);
        l2.clear();
        for (int i = a + b; i < a + b + c; i++) {
          l2.push_back(l[i]);
        }
        ta += make(l2, C);
        l2.clear();
        ans = min(ans, ta);
      }
    }
  } while (next_permutation(l, l + N));
  cout << ans << endl;
  return 0;
}
