#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const long long INF = 100000000000000000;
int N;
int A, B, C, L[8];
long long rec(int n = 0, int a = 0, int b = 0, int c = 0) {
  if (n == N) return abs(A - a) + abs(B - b) + abs(C - c);
  long long min_ = rec(n + 1, a, b, c);
  chmin(min_, rec(n + 1, a + L[n], b, c) + (a ? 10 : 0));
  chmin(min_, rec(n + 1, a, b + L[n], c) + (b ? 10 : 0));
  chmin(min_, rec(n + 1, a, b, c + L[n]) + (c ? 10 : 0));
  return min_;
}
void solve() {
  cin >> N >> A >> B >> C;
  for (int n = 0; n < N; n++) cin >> L[n];
  cout << rec() << endl;
}
int main() {
  solve();
  return 0;
}
