def dfs(i, a, b, c):
    if i == N:
        return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a, b, c) > 0 else float('inf')
    mx = dfs(i+1, a, b, c)
    ma = dfs(i+1, a+l[i], b, c) + 10
    mb = dfs(i+1, a, b+l[i], c) + 10
    mc = dfs(i+1, a, b, c+l[i]) + 10
    return min(mx, ma, mb, mc)


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