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

ans = float('inf')
for a in range(1<<N):
    at = []
    for i in range(N):
        if a&(1<<i):
            at.append(L[i])
    if not at: continue
    ap = 10*(len(at)-1) + abs(A - sum(at))
    for b in range(1<<N):
        if a&b: continue
        bt = []
        for i in range(N):
            if b&(1<<i):
                bt.append(L[i])
        if not bt: continue
        bp = 10*(len(bt)-1) + abs(B - sum(bt))
        for c in range(1<<N):
            if (a&c) or (b&c): continue
            ct = []
            for i in range(N):
                if c&(1<<i):
                    ct.append(L[i])
            if not ct: continue
            cp = 10*(len(ct)-1) + abs(C - sum(ct))
            ans = min(ans, ap+bp+cp)
print(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)] ans = float('inf') ans float('inf') float 'inf' for a in range(1<<N):
    at = []
    for i in range(N):
        if a&(1<<i):
            at.append(L[i])
    if not at: continue
    ap = 10*(len(at)-1) + abs(A - sum(at))
    for b in range(1<<N):
        if a&b: continue
        bt = []
        for i in range(N):
            if b&(1<<i):
                bt.append(L[i])
        if not bt: continue
        bp = 10*(len(bt)-1) + abs(B - sum(bt))
        for c in range(1<<N):
            if (a&c) or (b&c): continue
            ct = []
            for i in range(N):
                if c&(1<<i):
                    ct.append(L[i])
            if not ct: continue
            cp = 10*(len(ct)-1) + abs(C - sum(ct))
            ans = min(ans, ap+bp+cp) a range(1<<N) range 1<<N 1 N at = [] at [] for i in range(N):
        if a&(1<<i):
            at.append(L[i])
     i range(N) range N if a&(1<<i):
            at.append(L[i])
     a&(1<<i) a 1<<i 1 i at.append(L[i]) at.append at append L[i] L i if not at: continue
     not at at ap = 10*(len(at)-1) + abs(A - sum(at)) ap 10*(len(at)-1) + abs(A - sum(at)) 10*(len(at)-1) 10 len(at)-1 len(at) len at 1 abs(A - sum(at)) abs A - sum(at) A sum(at) sum at for b in range(1<<N):
        if a&b: continue
        bt = []
        for i in range(N):
            if b&(1<<i):
                bt.append(L[i])
        if not bt: continue
        bp = 10*(len(bt)-1) + abs(B - sum(bt))
        for c in range(1<<N):
            if (a&c) or (b&c): continue
            ct = []
            for i in range(N):
                if c&(1<<i):
                    ct.append(L[i])
            if not ct: continue
            cp = 10*(len(ct)-1) + abs(C - sum(ct))
            ans = min(ans, ap+bp+cp) b range(1<<N) range 1<<N 1 N if a&b: continue
         a&b a b bt = [] bt [] for i in range(N):
            if b&(1<<i):
                bt.append(L[i])
         i range(N) range N if b&(1<<i):
                bt.append(L[i])
         b&(1<<i) b 1<<i 1 i bt.append(L[i]) bt.append bt append L[i] L i if not bt: continue
         not bt bt bp = 10*(len(bt)-1) + abs(B - sum(bt)) bp 10*(len(bt)-1) + abs(B - sum(bt)) 10*(len(bt)-1) 10 len(bt)-1 len(bt) len bt 1 abs(B - sum(bt)) abs B - sum(bt) B sum(bt) sum bt for c in range(1<<N):
            if (a&c) or (b&c): continue
            ct = []
            for i in range(N):
                if c&(1<<i):
                    ct.append(L[i])
            if not ct: continue
            cp = 10*(len(ct)-1) + abs(C - sum(ct))
            ans = min(ans, ap+bp+cp) c range(1<<N) range 1<<N 1 N if (a&c) or (b&c): continue
             (a&c) or (b&c) a&c a c b&c b c ct = [] ct [] for i in range(N):
                if c&(1<<i):
                    ct.append(L[i])
             i range(N) range N if c&(1<<i):
                    ct.append(L[i])
             c&(1<<i) c 1<<i 1 i ct.append(L[i]) ct.append ct append L[i] L i if not ct: continue
             not ct ct cp = 10*(len(ct)-1) + abs(C - sum(ct)) cp 10*(len(ct)-1) + abs(C - sum(ct)) 10*(len(ct)-1) 10 len(ct)-1 len(ct) len ct 1 abs(C - sum(ct)) abs C - sum(ct) C sum(ct) sum ct ans = min(ans, ap+bp+cp) ans min(ans, ap+bp+cp) min ans ap+bp+cp ap+bp ap bp cp print(ans) print ans C = map(int,input().split()) map(int,input().split()) C bp = 10*(len(bt)-1) + abs(B - sum(bt)) 10*(len(bt)-1) + abs(B - sum(bt)) bp ans = min(ans, ap+bp+cp) min(ans, ap+bp+cp) ans L = [int(input()) for i in range(N)] [int(input()) for i in range(N)] L ct = [] [] ct cp = 10*(len(ct)-1) + abs(C - sum(ct)) 10*(len(ct)-1) + abs(C - sum(ct)) cp A,B,C = map(int,input().split()) map(int,input().split()) A B,C = map(int,input().split()) map(int,input().split()) B bt = [] [] bt N,A,B,C = map(int,input().split()) map(int,input().split()) N ans = float('inf') float('inf') ans ap = 10*(len(at)-1) + abs(A - sum(at)) 10*(len(at)-1) + abs(A - sum(at)) ap at = [] [] at
N,A,B,C = map(int,input().split())
L = [int(input()) for i in range(N)]

ans = float('inf')
for a in range(1<<N):
    at = []
    for i in range(N):
        if a&(1<<i):
            at.append(L[i])
    if not at: continue
    ap = 10*(len(at)-1) + abs(A - sum(at))
    for b in range(1<<N):
        if a&b: continue
        bt = []
        for i in range(N):
            if b&(1<<i):
                bt.append(L[i])
        if not bt: continue
        bp = 10*(len(bt)-1) + abs(B - sum(bt))
        for c in range(1<<N):
            if (a&c) or (b&c): continue
            ct = []
            for i in range(N):
                if c&(1<<i):
                    ct.append(L[i])
            if not ct: continue
            cp = 10*(len(ct)-1) + abs(C - sum(ct))
            ans = min(ans, ap+bp+cp)
print(ans)