#include <bits/stdc++.h>
using namespace std;
int N, A, B, C, l[1000];
int dsf(int n, int a, int b, int c) {
  int ans1, ans2;
  if (n >= N) {
    if (a && B && C) {
      return abs(A - a) + abs(B - b) + abs(C - c);
    } else {
      return 1e9;
    }
  }
  ans1 = min(dsf(n + 1, a, b, c), dsf(n + 1, a + l[n], b, c) + 10 * (a > 0));
  ans2 = min(dsf(n + 1, a, b + l[n], c) + 10 * (b > 0),
             dsf(n + 1, a, b, c + l[n]) + 10 * (c > 0));
  return min(ans1, ans2);
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) cin >> l[i];
  cout << dsf(0, 0, 0, 0);
  return 0;
}
