The input has several datasets. Each dataset has the following form.
N M
u1 v1 d1 c1
.
.
.
uM vM dM cM
The first line of a dataset has two integers, the number of cities N and the number of roads in the original plan M (1≤N≤10000, 0≤M≤20000).
Each of the next M lines describes one road of the original plan with four integers ui, vi, di, ci (1≤ui,vi≤N, ui=vi, 1≤di≤1000, 1≤ci≤1000). They mean that a road connects city ui and city vi, its length is di, and building it costs ci.
Every road is bidirectional. No two roads connect the same pair of cities. City 1 is the capital of the kingdom. In the original plan every city is reachable from the capital.
The input ends with a line holding two zeros separated by a space. Do not process that line as a dataset.