# Huffman Merge Cost ## Description Repeatedly merge two available weights, paying their sum each time, until one weight remains. Find the minimum possible total cost. ## Input The function receives the input weights and a writable work array. ## Output Return the minimum total merge cost. ## Constraints - $1 \le n \le 8$. - $1 \le weight_i \le 1000$. ## Source Classical Huffman optimal-merge problem reconstructed from the verified C artifact.