N, A, B, C = map(int, input().split())

ABC = [A, B, C]

l = [int(input()) for i in range(N)]

abc = [0 for i in range(N)]

ans = 1 << 30

def cost():
    take = [0 for i in range(3)]

    tmp = 0

    for i in range(N):
        if abc[i] == 0:
            continue
        take[abc[i]-1] += l[i]
        tmp += 1

    tmp = (tmp - 3) * 10

    for i in range(3):
        tmp += abs(ABC[i] - take[i])

    return tmp


def dfs(i):
    global ans
    if i == N:
        ans = min(ans, cost())
        return
    for j in range(4):
        abc[i] = j
        dfs(i+1)

dfs(0)
print(ans)