#include <bits/stdc++.h>
using namespace std;
int n, A, B, C;
vector<int> l;
int dfs(int depth, int a, int b, int c, int cost) {
  if (depth == n) {
    if (min({a, b, c}) < 0)
      return 1e9;
    else
      return abs(a - A) + abs(b - B) + abs(c - C) + cost;
  }
  int ret0 = dfs(depth + 1, a, b, c, cost);
  int ret1 = dfs(depth + 1, a + l[depth], b, c, cost + ((a == 0) ? 0 : 10));
  int ret2 = dfs(depth + 1, a, b + l[depth], c, cost + ((b == 0) ? 0 : 10));
  int ret3 = dfs(depth + 1, a, b, c + l[depth], cost + ((c == 0) ? 0 : 10));
  return min({ret0, ret1, ret2, ret3});
}
int main() {
  cin >> n >> A >> B >> C;
  l.resize(n);
  for (int i = 0; i < (int)(n); i++) cin >> l[i];
  cout << dfs(0, 0, 0, 0, 0) << endl;
}
