#include <bits/stdc++.h>
using namespace std;
int ans = INT_MAX;
int n;
vector<long long> k((8), (0));
;
int a[3];
vector<long long> v((8), (0));
;
void init() {
  cin >> n >> a[0] >> a[1] >> a[2];
  for (int(i) = 0; (i) < (n); (i)++) cin >> v[i];
}
int dfs(int i) {
  if (i == n) {
    int mp = 0;
    vector<long long> cnt((4), (0));
    ;
    vector<long long> tmp((3), (0));
    ;
    for (int(jj) = 0; (jj) < (n); (jj)++) {
      cnt[k[jj]]++;
      tmp[k[jj]] += v[jj];
    }
    if (cnt[0] * cnt[1] * cnt[2] != 0) {
      for (int(jj) = 0; (jj) < (3); (jj)++) mp += abs(tmp[jj] - a[jj]);
      mp += ((cnt[0] + cnt[1] + cnt[2] - 3) * 10);
      return mp;
    }
    return INT_MAX;
  }
  for (int(j) = 0; (j) < (4); (j)++) {
    k[i] = j;
    ans = min(dfs(i + 1), ans);
  }
  return ans;
}
int main() {
  init();
  cout << dfs(0) << endl;
  return 0;
}
