#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);
int main() {
  cin.sync_with_stdio(false);
  int N, A, B, C;
  vector<int> target(3);
  cin >> N;
  for (int i = 0; i < (int)(3); i++) cin >> target[i];
  vector<int> l(N);
  for (int i = 0; i < (int)(N); i++) cin >> l[i];
  int ans = INF;
  for (int i = 0; i < (int)(pow(4, N)); i++) {
    vector<int> tmp(3);
    int cnt = N;
    int I = i;
    int cost = 0;
    while (cnt--) {
      if (I % 4 < 3) {
        tmp[I % 4] += l[cnt - 1];
        if (tmp[I % 4] != l[cnt - 1]) cost += 10;
      }
      I /= 4;
    }
    bool flag = true;
    for (int j = 0; j < (int)(3); j++) {
      if (tmp[j] == 0) flag = false;
      cost += abs(tmp[j] - target[j]);
    }
    if (!flag) continue;
    ans = min(ans, cost);
  }
  cout << ans << endl;
  return 0;
}
