#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long longinf = 1LL << 60;
const long long mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  int a[3];
  for (int i = (int)(0); i < (int)(3); ++i) cin >> a[i];
  vector<long long> l(12, inf);
  for (int i = (int)(0); i < (int)(n); ++i) cin >> l[i];
  n = 13;
  int all = 1 << (2 * n);
  long long ans = inf;
  for (int i = (int)(0); i < (int)(all); ++i) {
    vector<int> sum(3);
    long long ret = -30;
    for (int j = (int)(0); j < (int)(n); ++j) {
      int u = (i >> (2 * j)) & 3;
      if (u != 3) {
        sum[u] += l[j];
        ret += 10;
      }
    }
    for (int j = (int)(0); j < (int)(3); ++j) {
      ret += abs(a[j] - sum[j]);
      if (!sum[j]) ret += 1e7;
    }
    ans = min(ans, ret);
  }
  cout << ans << endl;
  return 0;
}
