There are

villages, numbered from

to

. Initially, these

villages are all isolated.
Now, these

villages want to establish some **bi-directional** roads to achieve interconnection.
Building a road requires a certain cost. Specifically, building a bi-directional road between village

and village

costs
)
. The construction of a bi-directional road will be completed jointly by the two villages connected by this road. However, the human resources that each village can provide are limited. Village

can participate in the construction of at most

roads. In other words, there can be at most

roads that have village

as one endpoint.
What is the minimum cost to make all

villages reachable to each other via roads?