N,A,B,C= list(map(int,input().split()))
l=[]
Inf=float("Inf")
for i in range(N):l.append(int(input()))
def Answer(cnt,a,b,c):
   if cnt==N:
      return abs(A-a)+abs(B-b)+abs(C-c)-30 if min(a,b,c)>0 else Inf
   pt1=Answer(cnt+1,a,b,c)
   pt2=Answer(cnt+1,a+l[cnt],b,c)+10
   pt3=Answer(cnt+1,a,b+l[cnt],c)+10
   pt4=Answer(cnt+1,a,b,c+l[cnt])+10
   return(min(pt1,pt2,pt3,pt4))
print(Answer(0,0,0,0)) N,A,B,C= list(map(int,input().split())) N list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split A B C l=[] l [] Inf=float("Inf") Inf float("Inf") float "Inf" for i in range(N):l.append(int(input())) i range(N) range N def Answer(cnt,a,b,c):
   if cnt==N:
      return abs(A-a)+abs(B-b)+abs(C-c)-30 if min(a,b,c)>0 else Inf
   pt1=Answer(cnt+1,a,b,c)
   pt2=Answer(cnt+1,a+l[cnt],b,c)+10
   pt3=Answer(cnt+1,a,b+l[cnt],c)+10
   pt4=Answer(cnt+1,a,b,c+l[cnt])+10
   return(min(pt1,pt2,pt3,pt4)) Answer if cnt==N:
      return abs(A-a)+abs(B-b)+abs(C-c)-30 if min(a,b,c)>0 else Inf
    cnt==N cnt N return abs(A-a)+abs(B-b)+abs(C-c)-30 if min(a,b,c)>0 else Inf abs(A-a)+abs(B-b)+abs(C-c)-30 if min(a,b,c)>0 else Inf min(a,b,c)>0 min(a,b,c) min a b c 0 abs(A-a)+abs(B-b)+abs(C-c)-30 abs(A-a)+abs(B-b)+abs(C-c) abs(A-a)+abs(B-b) abs(A-a) abs A-a A a abs(B-b) abs B-b B b abs(C-c) abs C-c C c 30 Inf pt1=Answer(cnt+1,a,b,c) pt1 Answer(cnt+1,a,b,c) Answer cnt+1 cnt 1 a b c pt2=Answer(cnt+1,a+l[cnt],b,c)+10 pt2 Answer(cnt+1,a+l[cnt],b,c)+10 Answer(cnt+1,a+l[cnt],b,c) Answer cnt+1 cnt 1 a+l[cnt] a l[cnt] l cnt b c 10 pt3=Answer(cnt+1,a,b+l[cnt],c)+10 pt3 Answer(cnt+1,a,b+l[cnt],c)+10 Answer(cnt+1,a,b+l[cnt],c) Answer cnt+1 cnt 1 a b+l[cnt] b l[cnt] l cnt c 10 pt4=Answer(cnt+1,a,b,c+l[cnt])+10 pt4 Answer(cnt+1,a,b,c+l[cnt])+10 Answer(cnt+1,a,b,c+l[cnt]) Answer cnt+1 cnt 1 a b c+l[cnt] c l[cnt] l cnt 10 return(min(pt1,pt2,pt3,pt4)) min(pt1,pt2,pt3,pt4) min pt1 pt2 pt3 pt4 cnt cnt a a b b c c print(Answer(0,0,0,0)) print Answer(0,0,0,0) Answer 0 0 0 0 Inf=float("Inf") float("Inf") Inf A,B,C= list(map(int,input().split())) list(map(int,input().split())) A C= list(map(int,input().split())) list(map(int,input().split())) C def Answer(cnt,a,b,c):
   if cnt==N:
      return abs(A-a)+abs(B-b)+abs(C-c)-30 if min(a,b,c)>0 else Inf
   pt1=Answer(cnt+1,a,b,c)
   pt2=Answer(cnt+1,a+l[cnt],b,c)+10
   pt3=Answer(cnt+1,a,b+l[cnt],c)+10
   pt4=Answer(cnt+1,a,b,c+l[cnt])+10
   return(min(pt1,pt2,pt3,pt4)) def Answer(cnt,a,b,c):
   if cnt==N:
      return abs(A-a)+abs(B-b)+abs(C-c)-30 if min(a,b,c)>0 else Inf
   pt1=Answer(cnt+1,a,b,c)
   pt2=Answer(cnt+1,a+l[cnt],b,c)+10
   pt3=Answer(cnt+1,a,b+l[cnt],c)+10
   pt4=Answer(cnt+1,a,b,c+l[cnt])+10
   return(min(pt1,pt2,pt3,pt4)) Answer N,A,B,C= list(map(int,input().split())) list(map(int,input().split())) N l=[] [] l B,C= list(map(int,input().split())) list(map(int,input().split())) B
N,A,B,C= list(map(int,input().split()))
l=[]
Inf=float("Inf")
for i in range(N):l.append(int(input()))
def Answer(cnt,a,b,c):
   if cnt==N:
      return abs(A-a)+abs(B-b)+abs(C-c)-30 if min(a,b,c)>0 else Inf
   pt1=Answer(cnt+1,a,b,c)
   pt2=Answer(cnt+1,a+l[cnt],b,c)+10
   pt3=Answer(cnt+1,a,b+l[cnt],c)+10
   pt4=Answer(cnt+1,a,b,c+l[cnt])+10
   return(min(pt1,pt2,pt3,pt4))
print(Answer(0,0,0,0))