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

tar = []
for x in C, B, A:
    if x in l:
        l.remove(x)
    else:
        tar.append(x)

if not tar:
    print(0)
    exit()

ans = float('inf')
for j in range((len(tar) + 1) ** len(l)):
    vvv = [[] for _ in range(len(tar) + 1)]
    for i in sorted(range(len(l)), reverse=True):
        idx, j = divmod(j, (len(tar) + 1) ** i)
        vvv[idx].append(l[i])
    bbb = 0
    # print(tar, vvv)
    for k in range(len(tar)):
        bbb += 10 * (len(vvv[k]) - 1)
        bbb += abs(sum(vvv[k]) - tar[k])
    ans = min(ans, bbb)

print(ans)
