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


def dfs(lances, d, len_a, len_b, len_c):
    if d == N:
        if min(len_a, len_b, len_c) == 0:
            return INF
        else:
            return abs(A-len_a) + abs(B-len_b) + abs(C-len_c) - 30
    use_no = dfs(lances, d+1, len_a, len_b, len_c)
    use_for_a = dfs(lances, d+1, len_a + lances[d], len_b, len_c) + 10
    use_for_b = dfs(lances, d+1, len_a, len_b + lances[d], len_c) + 10
    use_for_c = dfs(lances, d+1, len_a, len_b, len_c + lances[d]) + 10
    return min(use_no, use_for_a, use_for_b, use_for_c)


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