#include <bits/stdc++.h>
using namespace std;
int INF = (1LL << 30) - 1;
int MOD = 1e9 + 7;
int N, A[3];
vector<int> V(8), used(8);
int dfs(int r) {
  if (r == 3) return 0;
  int mini = INF;
  for (int i = int(0); i < int(N); ++i) {
    if (used[i]) continue;
    used[i] = 1;
    mini = min(mini, abs(V[i] - A[r]) + dfs(r + 1));
    used[i] = 0;
  }
  for (int i = int(0); i < int(1 << N); ++i) {
    bool flag = 1;
    for (int j = int(0); j < int(N); ++j) {
      int mask = i & (1 << j);
      if (mask && used[j]) flag = 0;
    }
    if (!flag) continue;
    int num = 0;
    for (int j = int(0); j < int(N); ++j)
      if (i & (1 << j)) {
        used[j] = 1;
        num += V[j];
      }
    mini = min(mini,
               abs(num - A[r]) + (__builtin_popcount(i) - 1) * 10 + dfs(r + 1));
    for (int j = int(0); j < int(N); ++j)
      if (i & (1 << j)) used[j] = 0;
  }
  return mini;
}
int main() {
  cin >> N >> A[0] >> A[1] >> A[2];
  for (int i = int(0); i < int(N); ++i) cin >> V[i];
  cout << dfs(0) << endl;
}
