#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<long long>;
using vvi = vector<vi>;
using pii = pair<long long, long long>;
constexpr long long INF = 1LL << 60;
inline long long in() {
  long long x;
  cin >> x;
  return x;
}
template <typename T>
inline void out(const T &x) {
  cout << x << endl;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long dx[] = {0, 1, 0, -1, 1, -1, 1, -1},
                dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
long long gcd(long long a, long long b) {
  if (a < b) gcd(b, a);
  long long r;
  while ((r = a % b)) {
    a = b;
    b = r;
  }
  return b;
}
void eratos(bool *isPrime, long long max) {
  fill(isPrime, isPrime + max, true);
  isPrime[0] = false;
  isPrime[1] = false;
  for (long long i = 2; i <= max / i; ++i)
    if (isPrime[i])
      for (long long j = 2; j <= max / i; ++j) isPrime[i * j] = false;
}
long long N;
long long A, B, C;
long long l[8];
long long dfs(long long i, long long a, long long b, long long c) {
  if (i == N) {
    long long ans = abs(a - A) + abs(b - B) + abs(c - C) - 30;
    if (min({A, B, C}) <= 0) {
      return INF;
    }
    return ans;
  }
  return min({dfs(i + 1, a + l[i], b, c) + 10, dfs(i + 1, a, b + l[i], c) + 10,
              dfs(i + 1, a, b, c + l[i]) + 10, dfs(i + 1, a, b, c)});
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> N;
  cin >> A >> B >> C;
  for (long long i = 0; i < (N); ++i) {
    cin >> l[i];
  }
  cout << dfs(0, 0, 0, 0) << endl;
}
