#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long N, A, B, C;
long long l[9];
long long dfs(long long cur, long long a, long long b, long long c) {
  if (cur == N) {
    if (min({a, b, c}) > 0)
      return abs(A - a) + abs(B - b) + abs(C - c) - 30;
    else
      return 1e9;
  }
  long long rec0 = dfs(cur + 1, a + l[cur], b, c) + 10;
  long long rec1 = dfs(cur + 1, a, b + l[cur], c) + 10;
  long long rec2 = dfs(cur + 1, a, b, c + l[cur]) + 10;
  long long rec3 = dfs(cur + 1, a, b, c);
  return min({rec0, rec1, rec2, rec3});
}
signed main(void) {
  cin >> N >> A >> B >> C;
  for (long long i = 0; i < (N); i++) cin >> l[i];
  dfs(0, 0, 0, 0);
}
