There a big hexagon, the side length is n, so there are \(3n^2+3n+1\) points, and \(9n^2+3n\) edges. Each point has a weight.
We define the weight of each edge as the multiplying result of the weight of two endpoints in it. Please find out the minimum cost to connect these \(3n^2+3n+1\) points.