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