#include <bits/stdc++.h>
using namespace std;
constexpr int MAX_N = 8;
int N, A[3];
int l[MAX_N];
int dfs(int n, array<int, 3> a) {
  if (n == N) {
    int mp{};
    for (int i{}; i < 3; ++i) {
      if (a[i] == 0) {
        return 10000;
      }
      mp += abs(A[i] - a[i]);
    }
    mp -= 30;
    return mp;
  }
  int ret[4];
  for (int i{}; i < 3; ++i) {
    array<int, 3> na = a;
    na[i] += l[n];
    ret[i] = dfs(n + 1, na) + 10;
  }
  ret[3] = dfs(n + 1, a);
  sort(ret, ret + 4);
  return ret[0];
}
int main() {
  cin >> N;
  for (int i{}; i < 3; ++i) cin >> A[i];
  for (int i{}; i < N; ++i) cin >> l[i];
  array<int, 3> a;
  cout << dfs(0, a) << endl;
  return 0;
}
