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

INF = 1<<20
score = INF

import itertools
for ms in itertools.product(range(-1,3), repeat=N):
    lens = [0]*3
    tmp_score = -30
    for i, group in enumerate(ms):
        if group>=0:
            lens[group] += l[i]
            tmp_score += 10
    if all(lens):
        score = min(score, tmp_score + abs(lens[0]-A)+abs(lens[1]-B)+abs(lens[2]-C))

print(score)
