N, A, B, C = list(map(str, input().split()))
l = [0]*N
for i in range(N):
    l[i] = int(input())


def dfs(A_list, B_list, C_list, i):
    if i == N:
        return A - sum(A_list) + B - sum(B_list) + C - sum(C_list)

    dfs_not_used = dfs(A_list, B_list, C_list, i+1)
    dfs_A = dfs(A_list.append(l[i]), B_list, C_list, i+1) + 10
    dfs_B = dfs(A_list, B_list.append(l[i]), C_list, i+1) + 10
    dfs_C = dfs(A_list, B_list, C_list.append(l[i]), i+1) + 10

    return min(dfs_not_used, dfs_A, dfs_B, dfs_C)


ans = dfs([0], [0], [0], 8)
print(ans)
