#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using P = pair<int, int>;
int n, a, b, c;
vector<int> l;
int ans = 1001001001;
void calc(vector<int> &vec) {
  int tmp = 0;
  int p = 0;
  int q = 0;
  int r = 0;
  int s = 0;
  for (int i = 0; i < vec.size(); i++) {
    if (vec[i] == 0) {
      p += l[i];
    } else if (vec[i] == 1) {
      q += l[i];
    } else if (vec[i] == 2) {
      r += l[i];
    } else if (vec[i] == 3) {
      s += l[i];
    }
  }
  for (int i = 0; i < 3; i++) {
    int x = count(vec.begin(), vec.end(), i);
    x = (x - 1) * 10;
    tmp += max(0, x);
  }
  tmp += (abs(p - a) + abs(q - b) + abs(r - c));
  if (ans > tmp) {
    ans = min(ans, tmp);
  }
}
void dfs(int depth, vector<int> &v) {
  if (depth == n) {
    calc(v);
    return;
  }
  for (int i = 0; i < 4; i++) {
    v[depth] = i;
    dfs(depth + 1, v);
  }
}
int main() {
  cin >> n >> a >> b >> c;
  l.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }
  vector<int> vec(n);
  dfs(0, vec);
  cout << ans << endl;
  return 0;
}
