N, A, B, C = [int(_) for _ in input().split()]
H = [int(input()) for _ in range(N)]
INF = 1000 * 1000

def dfs(h, a, b, c):
    if not h:
        return INF if a * b * c == 0 else abs(A - a)+  abs(B - b) + abs(C - c)

    k = h[0]
    return min(dfs(h[1:], a, b, c),
               dfs(h[1:], a + k, b, c) + 10,
               dfs(h[1:], a, b + k, c) + 10,
               dfs(h[1:], a, b, c + k) + 10)

print(dfs(H, 0, 0, 0) - 30)
