PROGRAMMING:Local minimum cost problem of smooth engineering
Through the investigation of urban traffic conditions in a certain area, the statistical data of the existing expressways between cities and towns are obtained, and the goal of "smooth engineering" is put forward: to realize the rapid traffic between any two cities and towns in the whole area (but there is not necessarily a direct connection between the expressways, as long as they can reach each other indirectly through the expressways). Now we get the statistical table of urban roads, which lists the cost of building expressways between any two towns, and whether the road has been completed. Now please write a program to calculate the minimum cost of the whole area.
###Input format:
The first line of input gives the number of villages $$n $$($$1 / Le n / Le 100 $$); The next $$n (n-1) / 2 $$line corresponds to the cost and construction status of the road between villages: each line gives four positive integers, which are the number of two villages (from 1 to $$n $), the cost of the road between the two villages, and the construction status - 1 means built, 0 means not built.
###Output format:
Export the lowest cost needed by the whole province.
###Input example:
```in
four
1 2 1 1
1 3 4 0
1 4 1 1
2 3 3 0
2 4 2 1
3 4 5 0
```
###Output example:
```out
three
```
answer:If there is no answer, please comment
###Input format:
The first line of input gives the number of villages $$n $$($$1 / Le n / Le 100 $$); The next $$n (n-1) / 2 $$line corresponds to the cost and construction status of the road between villages: each line gives four positive integers, which are the number of two villages (from 1 to $$n $), the cost of the road between the two villages, and the construction status - 1 means built, 0 means not built.
###Output format:
Export the lowest cost needed by the whole province.
###Input example:
```in
four
1 2 1 1
1 3 4 0
1 4 1 1
2 3 3 0
2 4 2 1
3 4 5 0
```
###Output example:
```out
three
```
answer:If there is no answer, please comment