#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

i64 N,A,B,C;
vector<i64> l;

i64 rec(i64 i,i64 a,i64 b,i64 c) {
  if(i == N) {
    if(a == 0 || b == 0 || c == 0) return 1e18;
    return abs(A - a) + abs(B - b) + abs(C - c);
  }
  return min({ rec(i + 1, a, b, c), 
      rec(i + 1, a + l[i], b, c) + 10,
      rec(i + 1, a, b + l[i], c) + 10,
      rec(i + 1, a, b, c + l[i]) + 10});
}

int main() {
  cin >> N >> A >> B >> C;
  l.resize(N);
  rep(i,0,N - 1) cin >> l[i];
  cout << rec(0,0,0,0) - 3 * 10 << endl;
}
