#include <bits/stdc++.h>
using namespace std;
long long int N, A, B, C;
long long int arr[10];
long long int rec(long long int ind, long long int a, long long int b,
                  long long int c) {
  if (ind == N) {
    if (!a || !b || !c) {
      return 1000000007;
    }
    return abs(A - a) + abs(B - b) + abs(C - c);
  }
  long long int ans = 1000000007;
  ans = rec(ind + 1, a, b, c);
  ans = min(ans, rec(ind + 1, a + arr[ind], b, c) + (a ? 10 : 0));
  ans = min(ans, rec(ind + 1, a, b + arr[ind], c) + (b ? 10 : 0));
  ans = min(ans, rec(ind + 1, a, b, c + arr[ind]) + (c ? 10 : 0));
}
int main() {
  scanf("%lld %lld %lld %lld", &N, &A, &B, &C);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &arr[i]);
  }
  cout << rec(0, 0, 0, 0);
  return 0;
}
