n, a, b, c = map(int,input().split())
l = [int(input()) for i in range(n)]

def dfs(x, y, z, now):

    if now == n:
        return abs(x - a) + abs(y - b) + abs(z - c) - 30 if not 0 in (x, y, z) else 3000

    usea = dfs(x + l[now], y, z, now + 1) + 10
    useb = dfs(x, y + l[now], z, now + 1) + 10
    usec = dfs(x, y, z + l[now], now + 1) + 10
    nouse = dfs(x, y, z, now + 1)
    return min(usea, useb, usec, nouse)

print(dfs(0,0,0,0))