{"raw_statement":[{"iden":"problem statement","content":"We have a simple connected undirected graph with $N$ vertices and $M$ edges.  \nThe vertices are numbered as Vertex $1$, Vertex $2$, $\\dots$, Vertex $N$.  \nThe edges are numbered as Edge $1$, Edge $2$, $\\dots$, Edge $M$. Edge $i$ connects Vertex $a_i$ and Vertex $b_i$ bidirectionally. There is no edge that directly connects Vertex $1$ and Vertex $N$.  \nEach vertex is either empty or occupied by a wall. Initially, every vertex is empty.\nAoki is going to travel from Vertex $1$ to Vertex $N$ along the edges on the graph. However, Aoki is not allowed to move to a vertex occupied by a wall.\nTakahashi has decided to choose some of the vertices to build walls on, so that Aoki cannot travel to Vertex $N$ no matter which route he takes.  \nBuilding a wall on Vertex $i$ costs Takahashi $c_i$ yen (the currency of Japan). **He cannot build a wall on Vertex $1$ and Vertex $N$**.\nHow many yens is required for Takahashi to build walls so that the conditions is satisfied? Also, print the way of building walls to achieve the minimum cost."},{"iden":"constraints","content":"*   $3 \\leq N \\leq 100$\n*   $N - 1 \\leq M \\leq \\frac{N(N-1)}{2} - 1$\n*   $1 \\leq a_i \\lt b_i \\leq N$ $(1 \\leq i \\leq M)$\n*   $(a_i, b_i) \\neq (1, N)$\n*   The given graph is simple and connected.\n*   $1 \\leq c_{i} \\leq 10^9$ $(2 \\leq i \\leq N-1)$\n*   $c_1 = c_N = 0$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$\n$a_1$ $b_1$\n$a_2$ $b_2$\n$\\vdots$\n$a_M$ $b_M$\n$c_1$ $c_2$ $\\dots$ $c_N$"},{"iden":"sample input 1","content":"5 5\n1 2\n2 3\n3 5\n2 4\n4 5\n0 8 3 4 0"},{"iden":"sample output 1","content":"7\n2\n3 4\n\nIf Takahashi builds walls on Vertex $3$ and Vertex $4$, paying $3 + 4 = 7$ yen, Aoki is unable to travel from Vertex $1$ to Vertex $5$.  \nThere is no way to satisfy the condition with less cost, so $7$ yen is the answer."},{"iden":"sample input 2","content":"3 2\n1 2\n2 3\n0 1 0"},{"iden":"sample output 2","content":"1\n1\n2"},{"iden":"sample input 3","content":"5 9\n1 2\n1 3\n1 4\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5\n0 1000000000 1000000000 1000000000 0"},{"iden":"sample output 3","content":"3000000000\n3\n2 3 4"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}