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