CSES - Distance Sums
  • Time limit: 1.00 s
  • Memory limit: 512 MB

We have a directed graph with nn nodes and mm edges. Edge ii is from aia_{i} to bib_{i} with cost cic_{i}. There are kk special nodes in a graph, namely s1,,sks_{1}, \cdots, s_{k}.

Call D(x,y)D(x, y) the minimum cost of a path from node xx to node yy. Calculate for every node ii the value F(i)=j=1kD(i,sj)F(i) = \sum_{j = 1}^{k} D(i, s_{j}), that is, the sum of distances from that node to every special node.

It is guaranteed that every node is reachable from every other node.

Input

The first line contains the three integers nn mm kk.

Then mm lines follow. Every line contains the three integers aia_{i} bib_{i} cic_{i}.

The last line contains the kk integers sis_{i}.

Output

Output nn integers: the values F(i)F(i).

Constraints

  • 1n10001 \leq n \leq 1000
  • nm5105n \leq m \leq 5 * 10^{5}
  • 1k201 \leq k \leq 20
  • 1ci1091 \leq c_{i} \leq 10^{9}
  • 1ai,bin1 \leq a_{i}, b_{i} \leq n

Example

Input:

4 6 2
4 1 10
2 3 4
1 2 10
3 4 6
3 1 9
2 3 3
2 3 

Output:

23 3 19 43