#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int N, A[3];
vector<int> l;
vector<int> p;
int dfs(int i = 0) {
  int ret = INT32_MAX;
  if (i == N) {
    int use = 0;
    int sm[3] = {0};
    for (int i = 0; i < (N); ++i) {
      if (p[i] != 3) {
        sm[p[i]] += l[i];
        use++;
      }
    }
    ret = (use - 3) * 10;
    for (int i = 0; i < (3); ++i) {
      ret += abs(sm[i] - A[i]);
    }
    return ret;
  }
  p[i] = 0;
  ret = min(ret, dfs(i + 1));
  p[i] = 1;
  ret = min(ret, dfs(i + 1));
  p[i] = 2;
  ret = min(ret, dfs(i + 1));
  p[i] = 3;
  ret = min(ret, dfs(i + 1));
  return ret;
}
int main() {
  cin >> N >> A[0] >> A[1] >> A[2];
  l.resize(N);
  for (int i = 0; i < (N); ++i) cin >> l[i];
  p.resize(N);
  cout << dfs(0) << endl;
  return 0;
}
