#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
int N, A, B, C;
vector<int> l;
const int inf = 1 << 10;
int rec(int i, int a, int b, int c) {
  int ans = inf;
  if (i == N) {
    if (a && b && c) ans = abs(A - a) + abs(B - b) + abs(C - c);
    return ans;
  }
  chmin(ans, rec(i + 1, a, b, c));
  chmin(ans, rec(i + 1, a + l[i], b, c) + (a ? 10 : 0));
  chmin(ans, rec(i + 1, a, b + l[i], c) + (b ? 10 : 0));
  chmin(ans, rec(i + 1, a, b, c + l[i]) + (c ? 10 : 0));
  return ans;
}
int main() {
  scanf("%d %d %d %d", &N, &A, &B, &C);
  l.resize(N);
  for (int i = 0; i < N; i++) scanf("%d", &l[i]);
  int ans = rec(0, 0, 0, 0);
  printf("%d\n", ans);
}
