#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  vector<int> ABC(3);
  cin >> N >> ABC[0] >> ABC[1] >> ABC[2];
  vector<int> l(N);
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }
  int min = 100000;
  for (int i = 0; i < (int)pow(4, N); i++) {
    vector<int> type(N);
    bitset<16> bs(i);
    for (int j = 0; j < N; j++) {
      type[j] = 2 * bs[2 * j + 1] + bs[2 * j];
    }
    int cost = 0;
    bool all = true;
    for (int j = 0; j < 3; j++) {
      int use = 0;
      int sum = 0;
      for (int k = 0; k < N; k++) {
        if (type[k] == j) {
          use++;
          sum += l[k];
        }
      }
      cost += (use - 1) * 10 + abs(ABC[j] - sum);
      all = all && (use != 0);
    }
    if (cost < min && all) {
      min = cost;
    }
  }
  cout << min << endl;
}
