#include <bits/stdc++.h>
static int N, A, B, C;
static int LEN[8];
unsigned int min(unsigned int a, unsigned int b) { return (a < b) ? a : b; }
unsigned int search(int i, int a, int b, int c) {
  if (i == N) {
    int cost = abs(a - A) + abs(b - B) + abs(c - C) - 30;
    return (a == 0 || b == 0 || c == 0) ? 1000000000 : cost;
  } else {
    unsigned int cost1 = search(i + 1, a, b, c);
    unsigned int cost2 = search(i + 1, a + LEN[i], b, c) + 10;
    unsigned int cost3 = search(i + 1, a, b + LEN[i], c) + 10;
    unsigned int cost4 = search(i + 1, a, b, c + LEN[i]) + 10;
    return min(min(cost1, cost2), min(cost3, cost4));
  }
}
int main(void) {
  scanf("%d%d%d%d", &N, &A, &B, &C);
  for (int i = 0; i < N; i++) {
    scanf("%d", &LEN[i]);
  }
  printf("%d\n", search(0, 0, 0, 0));
  return 0;
}
