#include <bits/stdc++.h>
int N, A, B, C;
int INF = 1000000000;
int* l;
int dfs(int cur, int a, int b, int c) {
  if (cur == N) {
    if (std::min({a, b, c}) < 0) {
      return INF;
    }
    return std::abs(a - A) + std::abs(b - B) + std::abs(c - C) - 30;
  }
  int ret0 = dfs(cur + 1, a, b, c);
  int ret1 = dfs(cur + 1, a + l[cur], b, c) + 10;
  int ret2 = dfs(cur + 1, a, b + l[cur], c) + 10;
  int ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10;
  return std::min({ret0, ret1, ret2, ret3});
}
int main() {
  std::cin >> N >> A >> B >> C;
  int in[N];
  for (int i = 0; i < N; i++) {
    std::cin >> in[i];
  }
  l = in;
  std::cout << dfs(0, 0, 0, 0);
}
