import sys
input=sys.stdin.readline

n,a,b,c=map(int,input().split())
L=[]
A=[a,b,c]
for i in range(n):
    L.append(int(input()))
L.sort()

ans=10**9
for i in range(4**n):
    F=[[] for i in range(3)] #竹格納:[A,B,C]
    now=i
    for j in range(n):
        r=now%(4**(j+1))
        chk=r//(4**(j))
        if chk!=3:
            F[chk].append(L[j])
        now-=r    
    if F[0] and F[1] and F[2]: #竹が1本以上あるとき
        mp=0
        for k in range(3):
            f=F[k]
            mp+=abs(sum(f)-A[k])+10*(max(0,len(f)-1))
        ans=min(mp,ans)
print(ans) import sys sys input=sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline n,a,b,c=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split a b c L=[] L [] A=[a,b,c] A [a,b,c] a b c for i in range(n):
    L.append(int(input())) i range(n) range n L.append(int(input())) L.append L append int(input()) int input() input L.sort() L.sort L sort ans=10**9 ans 10**9 10 9 for i in range(4**n):
    F=[[] for i in range(3)] #竹格納:[A,B,C]
    now=i
    for j in range(n):
        r=now%(4**(j+1))
        chk=r//(4**(j))
        if chk!=3:
            F[chk].append(L[j])
        now-=r    
    if F[0] and F[1] and F[2]: #竹が1本以上あるとき
        mp=0
        for k in range(3):
            f=F[k]
            mp+=abs(sum(f)-A[k])+10*(max(0,len(f)-1))
        ans=min(mp,ans) i range(4**n) range 4**n 4 n [] for i in range(3) for i in range(3) i range(3) range 3 for i in range(3) [] F=[[] for i in range(3)] F [[] for i in range(3)] now=i now i for j in range(n):
        r=now%(4**(j+1))
        chk=r//(4**(j))
        if chk!=3:
            F[chk].append(L[j])
        now-=r    
     j range(n) range n r=now%(4**(j+1)) r now%(4**(j+1)) now 4**(j+1) 4 j+1 j 1 chk=r//(4**(j)) chk r//(4**(j)) r 4**(j) 4 j if chk!=3:
            F[chk].append(L[j])
         chk!=3 chk 3 F[chk].append(L[j]) [chk].append [chk] F chk append L[j] L j now-=r now r if F[0] and F[1] and F[2]: #竹が1本以上あるとき
        mp=0
        for k in range(3):
            f=F[k]
            mp+=abs(sum(f)-A[k])+10*(max(0,len(f)-1))
        ans=min(mp,ans) F[0] and F[1] and F[2] F[0] and F[1] F[0] F 0 F[1] F 1 F[2] F 2 mp=0 mp 0 for k in range(3):
            f=F[k]
            mp+=abs(sum(f)-A[k])+10*(max(0,len(f)-1))
         k range(3) range 3 f=F[k] f F[k] F k mp+=abs(sum(f)-A[k])+10*(max(0,len(f)-1)) mp abs(sum(f)-A[k])+10*(max(0,len(f)-1)) abs(sum(f)-A[k]) abs sum(f)-A[k] sum(f) sum f A[k] A k 10*(max(0,len(f)-1)) 10 max(0,len(f)-1) max 0 len(f)-1 len(f) len f 1 ans=min(mp,ans) ans min(mp,ans) min mp ans print(ans) print ans f=F[k] F[k] f now-=r r now b,c=map(int,input().split()) map(int,input().split()) b ans=10**9 10**9 ans A=[a,b,c] [a,b,c] A mp+=abs(sum(f)-A[k])+10*(max(0,len(f)-1)) abs(sum(f)-A[k])+10*(max(0,len(f)-1)) mp L=[] [] L F=[[] for i in range(3)] [[] for i in range(3)] F r=now%(4**(j+1)) now%(4**(j+1)) r mp=0 0 mp n,a,b,c=map(int,input().split()) map(int,input().split()) n input=sys.stdin.readline sys.stdin.readline input c=map(int,input().split()) map(int,input().split()) c a,b,c=map(int,input().split()) map(int,input().split()) a ans=min(mp,ans) min(mp,ans) ans chk=r//(4**(j)) r//(4**(j)) chk now=i i now
import sys
input=sys.stdin.readline

n,a,b,c=map(int,input().split())
L=[]
A=[a,b,c]
for i in range(n):
    L.append(int(input()))
L.sort()

ans=10**9
for i in range(4**n):
    F=[[] for i in range(3)] #竹格納:[A,B,C]
    now=i
    for j in range(n):
        r=now%(4**(j+1))
        chk=r//(4**(j))
        if chk!=3:
            F[chk].append(L[j])
        now-=r    
    if F[0] and F[1] and F[2]: #竹が1本以上あるとき
        mp=0
        for k in range(3):
            f=F[k]
            mp+=abs(sum(f)-A[k])+10*(max(0,len(f)-1))
        ans=min(mp,ans)
print(ans)