#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int N, A, B, C;
vector<int> l;
int solve(int i, int a, int b, int c){
  if(i == N){
    if(a == 0 || b == 0 || c == 0) return 1e9;
    else return abs(A-a) + abs(B-b) + abs(C-c) - 30;
  }
  int ret;
  ret = solve(i+1, a, b, c);
  ret = min(ret, solve(i+1, a+l[i], b, c) + 10);
  ret = min(ret, solve(i+1, a, b+l[i], c) + 10);
  ret = min(ret, solve(i+1, a, b, c+l[i]) + 10);
  return ret;
}
int main(void){
  cin >> N >> A >> B >> C;
  l.resize(N);
  for(int i=0; i<N; i++) cin >> l[i];
  int ans = solve(0, 0, 0, 0);
  cout << ans << endl;
  return 0;
}