#include <bits/stdc++.h>
using namespace std;
int bamboom[9], A, B, C, n;
int dfs(int l, int a, int b, int c) {
  if (l == n) {
    if (a == 0 || b == 0 || c == 0) return 8001;
    return abs(A - a) + abs(B - b) + abs(C - c);
  }
  int r1 = dfs(l + 1, bamboom[l + 1] + a, b, c) + 10;
  int r2 = dfs(l + 1, a, bamboom[l + 1] + b, c) + 10;
  int r3 = dfs(l + 1, a, b, bamboom[l + 1] + c) + 10;
  int r4 = dfs(l + 1, a, b, c);
  return min(min(r1, r2), min(r3, r4));
}
int main() {
  scanf("%d %d %d %d", &n, &A, &B, &C);
  for (int i = 1; i <= n; i++) scanf("%d", &bamboom[i]);
  printf("%d", dfs(1, 0, 0, 0) - 30);
  return 0;
}
