#include <bits/stdc++.h>
using namespace std;
int ba[9];
int a, b, c, n;
int dfs(int l, int a1, int b1, int c1) {
  if (l == n) return abs(a - a1) + abs(b - b1) + abs(c - c1);
  if (a == 0 || b == 0 || c == 0) return 8001;
  int r1, r2, r3, r4;
  r1 = dfs(l + 1, a1 + ba[l + 1], b1, c1) + 10;
  r2 = dfs(l + 1, a1, b1 + ba[l + 1], c1) + 10;
  r3 = dfs(l + 1, a1, b1, c1 + ba[l + 1]) + 10;
  r4 = dfs(l + 1, a1, b1, c1);
  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", &ba[i]);
  printf("%d", dfs(0, 0, 0, 0) - 30);
  return 0;
}
