Code for the product-sum puzzle.