#P1274. Travel

Travel

题目描述

The country frog lives in has nn towns which are conveniently numbered by 1,2,,n1,2, \ldots, n .

Among n(n1)2\frac{n(n-1)}{2} pairs of towns, mm of them are connected by bidirectional highway, which needs aa minutes to travel. The other pairs are connected by railway, which needs bb minutes to travel.

Find the minimum time to travel from town 11 to town nn .

【简要题意】

给定一张 nn 个点的完全图, 边都是无向的。

一共有 n(n1)2\frac{n(n-1)}{2} 条边, 其中有 mm 条边的边权是 aa , 剩下的边边权 都是 bb

11nn 的最短路。

2n100000,0m5000002 \leq n \leq 100000,0 \leq m \leq 500000

输入格式

The input consists of multiple tests. For each test:

The first line contains 44 integers $n, m, a, b\left(2 \leq n \leq 10^{5}, 0 \leq m \leq 5 \cdot 10^{5}, 1 \leq a, b \leq 10^{9}\right)$ . Each of the following mm lines contains 22 integers ui,viu_{i}, v_{i} , which denotes cities uiu_{i} and viv_{i} are connected by highway. $( \left.1 \leq u_{i}, v_{i} \leq n, u_{i} \neq v_{i}\right)$

输出格式

For each test, write 11 integer which denotes the minimum time.

样例输入输出

3 2 1 3
1 2
2 3
3 2 2 3
1 2 
2 3
2
3