#include<stdio.h>
#include<math.h>

int i,j,k=0;
int N,A,B,C;
scanf("%d %d %d %d",&N,&A,&B,&C);

for(i=0;i<N;i++){
  scanf("%d",&A[i]);
}

int min(int a,int b){
  if(a > b)
    return b;
  else
    return a;
}

int dfs(int a,int b, int c, int d){
  if(d == N)
    return (abs(a-A)+abs(b-B)+abs(c-C) -30);
  int ret0 = dfs(a+A[d],b,c,d+1)+10;
  int ret1 = dfs(a,b+A[d],c,d+1)+10;
  int ret2 = dfs(a,b,c+A[d],d+1)+10;
  int ret3 = dfs(a,b,c,d+1);
  return min((min(a,b),min(c,d));
             }

int main(){
  printf("%d\n",dfs(0,0,0,0));
  return 0;
}
  