#include <bits/stdc++.h>
using namespace std;
int N, A, B, C;
int l[10];
int dfs(int n, int a, int b, int c) {
  int t1, t2;
  if (n == N) return abs(A - a) + abs(B - b) + abs(C - c) - 30;
  int ret0 = dfs(n + 1, a, b, c);
  int ret1 = dfs(n + 1, a + l[n], b, c) + 10;
  int ret2 = dfs(n + 1, a, b + l[n], c) + 10;
  int ret3 = dfs(n + 1, a, b, c + l[n]) + 10;
  t1 = min(ret0, ret1);
  t2 = min(ret2, ret3);
  return min(t1, t2);
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }
  cout << dfs(0, 0, 0, 0) << endl;
}
