#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
}
struct Class {
  Class() = default;
  Class(int _MP, const vector<int> &_i) : MP(_MP), indexes(_i) {}
  int MP;
  vector<int> indexes;
};
bool operator==(const Class &value, const Class &other) {
  for (int i = 0; i < value.indexes.size(); ++i) {
    for (int k = 0; k < other.indexes.size(); ++k) {
      if (value.indexes[i] == other.indexes[k]) {
        return true;
      }
    }
  }
  return false;
}
int main() {
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  vector<int> L(N);
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    cin >> L[i];
  }
  int num[3] = {A, B, C};
  vector<Class> rem[3];
  for (int i = 0; i < 3; ++i) {
    int t = num[i];
    for (int bit = 0; bit < (1 << N); ++bit) {
      int MP = 0;
      vector<int> use;
      int sum = 0;
      for (int k = 0; k < N; ++k) {
        if (bit & (1 << k)) {
          sum += L[k];
          MP += 10;
          use.push_back(k);
        }
      }
      MP += abs(sum - t) - 10;
      rem[i].push_back(Class(MP, use));
    }
  }
  long long min = 10e9 + 7;
  for (int i = 0; i < rem[0].size(); ++i) {
    for (int k = 0; k < rem[1].size(); ++k) {
      for (int m = 0; m < rem[2].size(); ++m) {
        if (rem[0][i] == rem[1][k]) {
          continue;
        }
        if (rem[1][k] == rem[2][m]) {
          continue;
        }
        if (rem[2][m] == rem[0][i]) {
          continue;
        }
        chmin(min, (long long)rem[0][i].MP + rem[1][k].MP + rem[2][m].MP);
      }
    }
  }
  cout << min << endl;
  return 0;
}
