#include <bits/stdc++.h>
using namespace std;
int n, A, B, C;
int v[100];
int compute(int cnt, int a, int b, int c) {
  if (cnt == n) {
    return abs(a - A) + abs(b - B) + abs(c - C) - 30;
  }
  int rez0 = compute(cnt + 1, a, b, c);
  int rez1 = compute(cnt + 1, a + v[cnt], b, c) + 10;
  int rez2 = compute(cnt + 1, a, b + v[cnt], c) + 10;
  int rez3 = compute(cnt + 1, a, b, c + v[cnt]) + 10;
  return min(rez0, min(rez1, min(rez2, rez3)));
}
int main() {
  scanf("%d%d%d%d", &n, &A, &B, &C);
  for (int i = 0; i < n; i++) {
    scanf("%d", &v[i]);
  }
  printf("%d", compute(0, 0, 0, 0));
}
