#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> I = {0, 1, 2};
vector<int> A(3);
vector<int> V;
vector<bool> used(N);
vector<bool> ok(3);
int ret = 0;
int ans = 1000000000;
int bitsolve(int x, int y) {
  int mn = 1000000000;
  int cnt = 0;
  for (int i = 0; i < (1 << N); i++) {
    vector<bool> u(N);
    int sum = 0;
    for (int j = 0; j < N; j++) {
      if (1 & (i >> j) && !used[j]) {
        sum += V[j];
        u[j] = true;
        cnt++;
      }
    }
    if (sum == A[x] && (cnt - 1) * 10 < mn) {
      ok[y] = true;
      mn = (cnt - 1) * 10;
      for (int j = 0; j < N; j++) {
        used[j] = u[j];
      }
    }
  }
  return mn;
}
int solve(int x, int y) {
  int mn = 1000000000;
  int mn_i = 0;
  for (int i = 0; i < N; i++) {
    if (!used[i] && abs(V[i] - A[x]) < mn) {
      mn = abs(V[i] - A[x]);
      mn_i = i;
      ok[y] = true;
    }
  }
  used[mn_i] = true;
  return mn;
}
int main() {
  cin >> N;
  V.resize(N);
  used.resize(N);
  for (int i = 0; i < 3; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> V[i];
  }
  do {
    for (int i = 0; i < (1 << 3); i++) {
      ret = 0;
      ok[0] = false;
      ok[1] = false;
      ok[2] = false;
      for (int j = 0; j < N; j++) {
        used[j] = false;
      }
      for (int j = 0; j < 3; j++) {
        if (1 & (i >> j)) {
          ret += bitsolve(I[j], j);
        } else {
          ret += solve(I[j], j);
        }
      }
      if (ok[0] && ok[1] && ok[2]) {
        ans = min(ret, ans);
      }
    }
  } while (next_permutation(I.begin(), I.end()));
  cout << ans << endl;
  return 0;
}
