#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e9;
int N, A, B, C;
int ans = INF;
vector<int> l(8);
vector<int> f(8);
int MPsum;
void calc(vector<int> f) {
  MPsum = 0;
  vector<int> cnt(4);
  for (int i = 0; i < N; ++i) {
    if (f[i] == 0) {
      A -= l[i];
      cnt[0]++;
    }
    if (f[i] == 1) {
      B -= l[i];
      cnt[1]++;
    }
    if (f[i] == 2) {
      C -= l[i];
      cnt[2]++;
    }
    if (f[i] == 3) {
      cnt[3]++;
    }
  }
  if (cnt[0] > 0 && cnt[1] > 0 && cnt[2] > 0) {
    MPsum += abs(A) + abs(B) + abs(C);
    for (int i = 0; i < int(3); ++i)
      if (cnt[i] >= 2) {
        MPsum += 10 * cnt[i] - 1;
      }
    ans = min(ans, MPsum);
  }
}
void dfs(int depth, vector<int> f) {
  if (depth == N) calc(f);
  for (int i = 0; i < 4; ++i) {
    f[depth] = i;
    depth++;
    dfs(depth, f);
  }
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < int(N); ++i) cin >> l[i];
  dfs(0, f);
  cout << ans << endl;
}
