The empire is under attack again. The general of empire is planning to defend his castle. The land can be seen as $N$ towns and $M$ roads, and each road has the same length and connects two towns. The town numbered $1$ is where general's castle is located, and the town numbered $N$ is where the enemies are staying. The general supposes that the enemies would choose a shortest path. He knows his army is not ready to fight and he needs more time. Consequently he decides to put some barricades on some roads to slow down his enemies. Now, he asks you to find a way to set these barricades to make sure the enemies would meet at least one of them. Moreover, the barricade on the $i$-th road requires $w_i$ units of wood. Because of lacking resources, you need to use as less wood as possible.