#include <bits/stdc++.h>
using namespace std;
long long INF = 1e18;
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
int N, A, B, C;
int ans = 0;
int L[10];
int dfs(int k, int a, int b, int c) {
  if (k == N) {
    if (min(a, min(b, c))) {
      return abs(a - A) + abs(b - B) + abs(c - C);
    } else {
      return 101000;
    }
  }
  int ans = 101000;
  ans = min(ans, dfs(k + 1, a, b, c));
  ans = min(ans, dfs(k + 1, a + L[k], b, c) + (a > 0 ? 10 : 0));
  ans = min(ans, dfs(k + 1, a, b + L[k], c) + (b > 0 ? 10 : 0));
  ans = min(ans, dfs(k + 1, a, b, c + L[k]) + (c > 0 ? 10 : 0));
  return ans;
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) cin >> L[i];
  int res = dfs(0, 0, 0, 0);
  cout << ans << endl;
}
