#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
const int INF = 1 << 30;
int N, A[3], L[8];
int main() {
  cin >> N;
  for (int i = 0; i < 3; i++) cin >> A[i];
  for (int i = 0; i < N; i++) cin >> L[i];
  vector<int> dp(1 << N, INF);
  dp[0] = 0;
  for (int i = 0; i < 3; i++) {
    vector<int> dp2(1 << N, INF);
    for (int j = 0; j < 1 << N; j++) {
      for (int k = 0; k < 1 << N; k++) {
        if (j & k) continue;
        int cost = (__builtin_popcount(k) - 1) * 10;
        int sum = 0;
        for (int l = 0; l < N; l++) {
          if ((k >> l) & 1) sum += L[l];
        }
        cost += abs(A[i] - sum);
        dp2[j | k] = min(dp2[j | k], dp[j] + cost);
      }
    }
    dp.swap(dp2);
  }
  cout << *min_element(begin(dp), end(dp)) << endl;
}
