#include <bits/stdc++.h>
using namespace std;
long long n, a, b, c, arr[10];
long long func(long long idx, long long na, long long nb, long long nc) {
  if (idx == n + 1) {
    if (a == 0 || b == 0 || c == 0) return 1e9;
    return abs(a - na) + abs(b - nb) + abs(c - nc);
  }
  long long ans = 1e9;
  ans = min(ans, func(idx + 1, na, nb, nc));
  if (na == 0)
    ans = min(ans, func(idx + 1, na + arr[idx], nb, nc));
  else
    ans = min(ans, func(idx + 1, na + arr[idx], nb, nc) + 10);
  if (nb == 0)
    ans = min(ans, func(idx + 1, na, nb + arr[idx], nc));
  else
    ans = min(ans, func(idx + 1, na, nb + arr[idx], nc) + 10);
  if (nc == 0)
    ans = min(ans, func(idx + 1, na, nb, nc + arr[idx]));
  else
    ans = min(ans, func(idx + 1, na, nb, nc + arr[idx]) + 10);
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> a >> b >> c;
  for (long long i = 1; i <= n; i++) cin >> arr[i];
  cout << func(1, 0, 0, 0);
}
