#include <bits/stdc++.h>
using namespace std;
int n, a, b, c;
vector<int> l;
const int INF = 1e9;
int brute_force(int k, int A, int B, int C) {
  if (k == n) {
    if (a == 0 || b == 0 || c == 0) return INF;
    return abs(a - A) + abs(b - B) + abs(c - C);
  }
  int ans = INF;
  ans = min(ans, brute_force(k + 1, A + l[k], B, C) + (A == 0 ? 0 : 10));
  ans = min(ans, brute_force(k + 1, A, B + l[k], C) + (B == 0 ? 0 : 10));
  ans = min(ans, brute_force(k + 1, A, B, C + l[k]) + (C == 0 ? 0 : 10));
  ans = min(ans, brute_force(k + 1, A, B, C));
  return ans;
}
int main() {
  cin >> n >> a >> b >> c;
  l = vector<int>(n);
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }
  cout << brute_force(0, 0, 0, 0);
  return 0;
}
