#include <bits/stdc++.h>
using namespace std;
long long int n, a, b, c, ans = 1e9, l[10];
bool f = 0;
void dfs(long long int now, long long int na, long long int ca,
         long long int nb, long long int cb, long long int nc,
         long long int cc) {
  if (now == n + 1) return;
  ans = min(
      ans, abs(a - na) + abs(b - nb) + abs(c - nc) +
               10ll * (max(0ll, ca - 1) + max(0ll, cb - 1) + max(0ll, cc - 1)));
  dfs(now + 1, na + l[now], ca + 1, nb, cb, nc, cc);
  dfs(now + 1, na, ca, nb + l[now], cb + 1, nc, cc);
  dfs(now + 1, na, ca, nb, cb, nc + l[now], cc + 1);
  dfs(now + 1, na, ca, nb, cb, nc, cc);
}
int main() {
  cin >> n >> a >> b >> c;
  for (int i = 0; i < n; i++) cin >> l[i];
  dfs(0, 0, 0, 0, 0, 0, 0);
  cout << ans << endl;
  return 0;
}
