#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A, B, C, res = INT_MAX;
  cin >> N >> A >> B >> C;
  vector<int> l(N);
  for (int i = 0; i < N; ++i) cin >> l[i];
  int a, b, c;
  vector<int> m(3);
  for (int i = 0; i < pow(4, N); ++i) {
    a = b = c = m[0] = m[1] = m[2] = 0;
    for (int j = 0; j < N; ++j) {
      switch ((int)(i / pow(4, j)) % 4) {
        case 0:
          a += l[j];
          m[0]++;
          break;
        case 1:
          b += l[j];
          m[1]++;
          break;
        case 2:
          c += l[j];
          m[2]++;
        case 3:
        default:
          break;
      }
    }
    res = min(
        res, abs(a - A) + abs(b - B) + abs(c - C) +
                 10 * (max(m[0] - 1, 0) + max(m[1] - 1, 0) + max(m[2] - 1, 0)));
  }
  cout << res;
  return 0;
}
