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