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