return cost of the mst