N,A,B,C = map(int,input().split())
L = [int(input()) for i in range(N)]

def cost(group,target):
    res = 10*(len(group)-1)
    return res + abs(sum(group)-target)

ans = []
for i in range(1<<(2*N)):
    groupA = []
    groupB = []
    groupC = []
    for j in range(N):
        s = i>>(2*j)
        if (s & 3) == 3:
            groupA.append(L[j])
        elif (s & 2) == 2:
            groupB.append(L[j])
        elif (s & 1) == 1:
            groupC.append(L[j])
    
    if len(groupA)==0 or len(groupB)==0 or len(groupC)==0:
        pass
    else:
        ans.append(cost(groupA,A)+cost(groupB,B)+cost(groupC,C))
print(min(ans)) N,A,B,C = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split A B C int(input()) for i in range(N) for i in range(N) i range(N) range N for i in range(N) int(input()) int input() input L = [int(input()) for i in range(N)] L [int(input()) for i in range(N)] def cost(group,target):
    res = 10*(len(group)-1)
    return res + abs(sum(group)-target) cost res = 10*(len(group)-1) res 10*(len(group)-1) 10 len(group)-1 len(group) len group 1 return res + abs(sum(group)-target) res + abs(sum(group)-target) res abs(sum(group)-target) abs sum(group)-target sum(group) sum group target group group target target ans = [] ans [] for i in range(1<<(2*N)):
    groupA = []
    groupB = []
    groupC = []
    for j in range(N):
        s = i>>(2*j)
        if (s & 3) == 3:
            groupA.append(L[j])
        elif (s & 2) == 2:
            groupB.append(L[j])
        elif (s & 1) == 1:
            groupC.append(L[j])
    
    if len(groupA)==0 or len(groupB)==0 or len(groupC)==0:
        pass
    else:
        ans.append(cost(groupA,A)+cost(groupB,B)+cost(groupC,C)) i range(1<<(2*N)) range 1<<(2*N) 1 2*N 2 N groupA = [] groupA [] groupB = [] groupB [] groupC = [] groupC [] for j in range(N):
        s = i>>(2*j)
        if (s & 3) == 3:
            groupA.append(L[j])
        elif (s & 2) == 2:
            groupB.append(L[j])
        elif (s & 1) == 1:
            groupC.append(L[j])
    
     j range(N) range N s = i>>(2*j) s i>>(2*j) i 2*j 2 j if (s & 3) == 3:
            groupA.append(L[j])
        elif (s & 2) == 2:
            groupB.append(L[j])
        elif (s & 1) == 1:
            groupC.append(L[j])
    
     (s & 3) == 3 s & 3 s 3 3 groupA.append(L[j]) groupA.append groupA append L[j] L j elif (s & 2) == 2:
            groupB.append(L[j])
         (s & 2) == 2 s & 2 s 2 2 groupB.append(L[j]) groupB.append groupB append L[j] L j elif (s & 1) == 1:
            groupC.append(L[j])
    
     (s & 1) == 1 s & 1 s 1 1 groupC.append(L[j]) groupC.append groupC append L[j] L j if len(groupA)==0 or len(groupB)==0 or len(groupC)==0:
        pass
    else:
        ans.append(cost(groupA,A)+cost(groupB,B)+cost(groupC,C)) len(groupA)==0 or len(groupB)==0 or len(groupC)==0 len(groupA)==0 or len(groupB)==0 len(groupA)==0 len(groupA) len groupA 0 len(groupB)==0 len(groupB) len groupB 0 len(groupC)==0 len(groupC) len groupC 0 ans.append(cost(groupA,A)+cost(groupB,B)+cost(groupC,C)) ans.append ans append cost(groupA,A)+cost(groupB,B)+cost(groupC,C) cost(groupA,A)+cost(groupB,B) cost(groupA,A) cost groupA A cost(groupB,B) cost groupB B cost(groupC,C) cost groupC C print(min(ans)) print min(ans) min ans A,B,C = map(int,input().split()) map(int,input().split()) A C = map(int,input().split()) map(int,input().split()) C def cost(group,target):
    res = 10*(len(group)-1)
    return res + abs(sum(group)-target) def cost(group,target):
    res = 10*(len(group)-1)
    return res + abs(sum(group)-target) cost N,A,B,C = map(int,input().split()) map(int,input().split()) N s = i>>(2*j) i>>(2*j) s B,C = map(int,input().split()) map(int,input().split()) B groupB = [] [] groupB L = [int(input()) for i in range(N)] [int(input()) for i in range(N)] L groupA = [] [] groupA ans = [] [] ans groupC = [] [] groupC
N,A,B,C = map(int,input().split())
L = [int(input()) for i in range(N)]

def cost(group,target):
    res = 10*(len(group)-1)
    return res + abs(sum(group)-target)

ans = []
for i in range(1<<(2*N)):
    groupA = []
    groupB = []
    groupC = []
    for j in range(N):
        s = i>>(2*j)
        if (s & 3) == 3:
            groupA.append(L[j])
        elif (s & 2) == 2:
            groupB.append(L[j])
        elif (s & 1) == 1:
            groupC.append(L[j])
    
    if len(groupA)==0 or len(groupB)==0 or len(groupC)==0:
        pass
    else:
        ans.append(cost(groupA,A)+cost(groupB,B)+cost(groupC,C))
print(min(ans))