#include <iostream>
#include <vector>

using namespace std;

int N, A, B, C,maxans;

maxans = 100000;
vector<int> l(100) = {-1};

int dfs(int depth, vector<int> l){
  int a, b, c, ans, counter = 0;
  if(depth == N-1){
    for(int i = 0; i < N; i++){
      if(c[i] == '1') {
         a += c[i];
         counter++;
      }
      if(c[i] == '2') {
         b += c[i];
         counter++;
      }
      if(c[i] == '3') {
         c += c[i];
         counter++;
      }
    }
    ans = counter * 10 + abs(A - a) + abs(B - b) + abs(C - c);
    minans = min(ans,maxans);
    return minans;
  } 
  for(int i = 0; i < 4; i++){
    c[depth + 1] = i;
    ans = dfs(depth + 1, l);
    return ans;
  }
}

int main(){
  int result = 0;
  cin >> N >> A >> B >> C;
  vector<int> c(N) = {0};
  for(int i = 0; i < N; i++)cin >> l[i];
  result = dfs(0,c);
  cout << result;
} 