#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 1 << 27;
int n, a, b, c;
vector<int> l(10);
int ans;
void dfs(int depth, vector<int> v) {
  if (depth == n + 1) {
    int ret = 0;
    if (find((v).begin(), (v).end(), 0) != v.end() ||
        find((v).begin(), (v).end(), 1) != v.end() ||
        find((v).begin(), (v).end(), 2) != v.end())
      ;
    else {
      vector<int> sum(3, 0);
      vector<int> cnt(3, 0);
      for (int i = 1; i < n + 1; i++) {
        if (v[i] == 0) sum[0] += l[i - 1], cnt[0]++;
        if (v[i] == 1) sum[1] += l[i - 1], cnt[1]++;
        if (v[i] == 2) sum[2] += l[i - 1], cnt[2]++;
      }
      int ret = 0;
      int tmp = 0;
      if (cnt[0] >= 2) tmp += (cnt[0] - 1) * 10;
      if (cnt[1] >= 2) tmp += (cnt[1] - 1) * 10;
      if (cnt[2] >= 2) tmp += (cnt[2] - 1) * 10;
      ret = abs(a - sum[0]) + abs(b - sum[1]) + abs(c - sum[2]) + tmp;
      ans = min(ans, ret);
    }
  } else
    for (int i = 0; i < 4; i++) {
      v.push_back(i);
      dfs(depth + 1, v);
    }
}
int main() {
  cin >> n >> a >> b >> c;
  l.resize(n);
  ans = INF;
  for (int i = 0; i < (int)(n); i++) cin >> l[i];
  vector<int> v(0);
  dfs(0, v);
  cout << ans << endl;
}
