#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
};
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
};
const long long INF = 1LL << 60;
int N, A, B, C;
int l[10];
long long int dfs(vector<int> &vec, long long int &ans) {
  if (vec.size() == N) {
    int a[3] = {};
    int nonzero = 0;
    for (int i = 0; i < (N); i++) {
      if (vec[i] == 3) continue;
      a[vec[i]] += l[i];
      nonzero++;
    }
    if (nonzero < 3 || a[0] == 0 || a[1] == 0 || a[2] == 0) return INF;
    long long int point = 10 * (nonzero - 3);
    point += abs(a[0] - A) + abs(a[1] - B) + abs(a[2] - C);
    return point;
  }
  for (int v = 0; v <= 3; v++) {
    vec.push_back(v);
    long long int res = dfs(vec, ans);
    chmin(ans, res);
    vec.pop_back();
  }
}
int main() {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < (N); i++) cin >> l[i];
  vector<int> init;
  long long int ans = INF;
  dfs(init, ans);
  cout << ans << endl;
  return 0;
}
