#include <bits/stdc++.h>
using namespace std;
using LLONG = long long;
int N, A, B, C;
const int DFS(const vector<int> &lengths, const int cur, const int a,
              const int b, const int c) {
  if (cur == N) {
    return abs(a - A) + abs(b - B) + abs(c - C) - 30;
  }
  int ret0 = DFS(lengths, cur + 1, a, b, c);
  int ret1 = DFS(lengths, cur + 1, a + lengths[cur], b, c) + 10;
  int ret2 = DFS(lengths, cur + 1, a, b + lengths[cur], c) + 10;
  int ret3 = DFS(lengths, cur + 1, a, b, c + lengths[cur]) + 10;
  return min({ret0, ret1, ret2, ret3});
}
int main() {
  cin >> N >> A >> B >> C;
  vector<int> lengths(N);
  for (int i = 0; i < N; ++i) {
    cin >> lengths[i];
  }
  cout << DFS(lengths, 0, 0, 0, 0) << endl;
}
