#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
double euclid_distance(double a, double b) { return sqrt(a * a + b * b); }
long long gcd(long long a, long long b) {
  long long r;
  if (a < b) {
    long long tmp;
    tmp = a;
    a = b;
    b = tmp;
  }
  while (r = a % b) {
    a = b;
    b = r;
  }
  return b;
}
void Integer_factorization(long long int b, long long int n) {
  long long int a = 2;
  long long int count = 0;
  long long int ans = 1;
  long long int ndash = n;
  if (b == 1)
    cout << n << endl;
  else {
    while (ndash >= a * a) {
      if (n % a == 0) {
        count++;
        n /= a;
        if (count % b == 0) {
          ans *= a;
        }
      } else {
        a++;
        count = 0;
      }
    }
    cout << ans << endl;
  }
}
long long r_fuct[2000];
long long fuct[2000];
void conb(long long n, long long k) {
  fuct[0] = 1;
  for (int i = 1; i < k + 1; i++) {
    fuct[i] *= fuct[i - 1] % 1000000007;
    long long b = 1000000007, u = 1, v = 0;
    long long value = fuct[i];
    while (b) {
      long long t = value / b;
      value -= t * b;
      swap(value, b);
      u -= t * v;
      swap(u, v);
    }
    u %= 1000000007;
    if (u < 0) u += 1000000007;
    r_fuct[i] = u;
  }
}
long long n, A, B, C;
vector<long long> vec;
long long rec(long long cur, long long a, long long b, long long c) {
  if (cur == n) {
    if (!(a & b & c))
      return 1000000000;
    else
      return abs(a - A) + abs(b - B) + abs(c - C) - 30;
  }
  long long res = rec(cur + 1, a, b, c);
  chmin(res, rec(cur + 1, a + vec[cur], b, c) + 10);
  chmin(res, rec(cur + 1, a, b + vec[cur], c) + 10);
  chmin(res, rec(cur + 1, a, b, c + vec[cur]) + 10);
  return res;
}
void solve() {
  cin >> n >> A >> B >> C;
  vec.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
  }
  cout << rec(0, 0, 0, 0);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}
