n, a, b, c = map(int, input().split())
L = [int(input()) for _ in range(n)]
targets = [a, b, c]

ans = 10**9
from itertools import product
for comb in product([0, 1, 2, 3], repeat=n):
    if len(set(comb)) in [1, 2]:
        continue
    # a, b, c
    ls = [[], [], []]
    for i, c in enumerate(comb):
        if c == 3:
            continue
        ls[c].append(L[i])

    mps = 0
    for idx, ll in enumerate(ls):
        if len(ll) == 0:
            break
        tmp = (len(ll)-1)*10
        mps += tmp
        mps += abs(targets[idx] - sum(ll))
    else:
        ans = min(ans, mps)
    
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 _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) int(input()) int input() input L = [int(input()) for _ in range(n)] L [int(input()) for _ in range(n)] targets = [a, b, c] targets [a, b, c] a b c ans = 10**9 ans 10**9 10 9 from itertools import product for comb in product([0, 1, 2, 3], repeat=n):
    if len(set(comb)) in [1, 2]:
        continue
    # a, b, c
    ls = [[], [], []]
    for i, c in enumerate(comb):
        if c == 3:
            continue
        ls[c].append(L[i])

    mps = 0
    for idx, ll in enumerate(ls):
        if len(ll) == 0:
            break
        tmp = (len(ll)-1)*10
        mps += tmp
        mps += abs(targets[idx] - sum(ll))
    else:
        ans = min(ans, mps)
     comb product([0, 1, 2, 3], repeat=n) product [0, 1, 2, 3] 0 1 2 3 repeat=n repeat n if len(set(comb)) in [1, 2]:
        continue
    # a, b, c
     len(set(comb)) in [1, 2] len(set(comb)) len set(comb) set comb [1, 2] 1 2 continue ls = [[], [], []] ls [[], [], []] [] [] [] for i, c in enumerate(comb):
        if c == 3:
            continue
        ls[c].append(L[i])

     i c enumerate(comb) enumerate comb if c == 3:
            continue
         c == 3 c 3 continue ls[c].append(L[i]) [c].append [c] ls c append L[i] L i mps = 0 mps 0 for idx, ll in enumerate(ls):
        if len(ll) == 0:
            break
        tmp = (len(ll)-1)*10
        mps += tmp
        mps += abs(targets[idx] - sum(ll))
    else:
        ans = min(ans, mps)
     idx ll enumerate(ls) enumerate ls if len(ll) == 0:
            break
         len(ll) == 0 len(ll) len ll 0 break tmp = (len(ll)-1)*10 tmp (len(ll)-1)*10 len(ll)-1 len(ll) len ll 1 10 mps += tmp mps tmp mps += abs(targets[idx] - sum(ll)) mps abs(targets[idx] - sum(ll)) abs targets[idx] - sum(ll) targets[idx] targets idx sum(ll) sum ll ans = min(ans, mps) ans min(ans, mps) min ans mps print(ans) print ans mps += abs(targets[idx] - sum(ll)) abs(targets[idx] - sum(ll)) mps L = [int(input()) for _ in range(n)] [int(input()) for _ in range(n)] L ans = 10**9 10**9 ans ans = min(ans, mps) min(ans, mps) ans a, b, c = map(int, input().split()) map(int, input().split()) a targets = [a, b, c] [a, b, c] targets c = map(int, input().split()) map(int, input().split()) c mps = 0 0 mps ls = [[], [], []] [[], [], []] ls tmp = (len(ll)-1)*10 (len(ll)-1)*10 tmp mps += tmp tmp mps b, c = map(int, input().split()) map(int, input().split()) b n, a, b, c = map(int, input().split()) map(int, input().split()) n
n, a, b, c = map(int, input().split())
L = [int(input()) for _ in range(n)]
targets = [a, b, c]

ans = 10**9
from itertools import product
for comb in product([0, 1, 2, 3], repeat=n):
    if len(set(comb)) in [1, 2]:
        continue
    # a, b, c
    ls = [[], [], []]
    for i, c in enumerate(comb):
        if c == 3:
            continue
        ls[c].append(L[i])

    mps = 0
    for idx, ll in enumerate(ls):
        if len(ll) == 0:
            break
        tmp = (len(ll)-1)*10
        mps += tmp
        mps += abs(targets[idx] - sum(ll))
    else:
        ans = min(ans, mps)
    
print(ans)
