JOI Park

No attempts yetTime limit1sMemory limit256 MB

Problem

As part of the preparation for the olympics held in the IOI country in 20XX, JOI park is going to be renovated. JOI park has NN squares, numbered 1 to NN. The park also has MM roads that join the squares, numbered 1 to MM. Road ii (1iM1 \le i \le M) joins square AiA_i and square BiB_i in both directions, and its length is DiD_i. From any square you can reach every other square by following roads.

The renovation plan goes as follows. A value CC for the subway construction is given. First, pick an integer XX that is at least 0 and join by subway every square whose distance from square 1 is at most XX, square 1 included. The distance between square ii and square jj is the smallest sum of road lengths over the routes from square ii to square jj. The subway construction costs C×XC \times X in total.

Next, tear down every road that joins two squares linked by the subway. Tearing down a road is free.

Finally, repair every road left standing. Repairing a road of length dd costs dd.

JOI park has no subway before the renovation starts. Given the squares and roads of JOI park together with the value for the subway construction, write a program that computes the smallest cost of renovating JOI park.

Input

Standard input holds the following information.

  • The first line holds the integers NN, MM, CC, separated by spaces. The park has NN squares and MM roads, and the value for the subway construction is CC.
  • Each of the next MM lines holds the integers AiA_i, BiB_i, DiD_i (1iM1 \le i \le M), separated by spaces. Road ii joins square AiA_i and square BiB_i, and its length is DiD_i.

Output

Print the smallest cost of renovating JOI park on one line.

Constraints

  • 2N1000002 \le N \le 100000
  • 1M2000001 \le M \le 200000
  • 1C1000001 \le C \le 100000
  • 1AiN1 \le A_i \le N (1iM1 \le i \le M)
  • 1BiN1 \le B_i \le N (1iM1 \le i \le M)
  • AiBiA_i \ne B_i (1iM1 \le i \le M)
  • (Ai,Bi)(Aj,Bj)(A_i, B_i) \ne (A_j, B_j) and (Ai,Bi)(Bj,Aj)(A_i, B_i) \ne (B_j, A_j) (1i<jM1 \le i < j \le M)
  • 1Di1000001 \le D_i \le 100000 (1iM1 \le i \le M)
  • From any square you can reach every other square by following roads.