ICPC (Isles of Coral Park City) is made up of several islands. The residents asked the city to build bridges between the islands so that they no longer depend on boats, and they require that every island be reachable from every other island over one or more bridges.
The mayor picked a number of island pairs and had a construction company estimate the cost of a bridge for each pair. He now has to decide which bridges to build so that all the islands are connected and the total construction cost is as small as possible.
Several different sets of bridges can reach that same minimum total cost. The mayor decided to start by building only the bridges that appear in every minimum cost set. Such a bridge is called a no alternative bridge.
Given the candidate bridges and their costs, write a program that reports how many no alternative bridges there are and what their construction costs add up to.
The input consists of a single test case.
N M
S1 D1 C1
.
.
.
SM DM CM
The first line contains the number of islands N and the number of island pairs M that a bridge may be built between. Each island is identified by an integer from 1 to N.
Each of the next M lines contains three integers Si, Di and Ci (1≤i≤M), meaning that building the bridge between island Si and island Di costs Ci.
3≤N≤500, N−1≤M≤min(50000,N(N−1)/2), 1≤Si<Di≤N, and 1≤Ci≤10000. No two bridges connect the same pair of islands, that is, if i=j and Si=Sj, then Di=Dj. If all the candidate bridges are built, every island is reachable from every other island over one or more bridges.
Print the number of no alternative bridges and the sum of their construction costs on one line, separated by a space.