Minimum Cost Route

Find the cheapest bus fare from city A to city B and print the fare, the city count, and the path, preferring fewer cities and then lexicographic order on ties.

Medium5Shortest pathHeapNo attempts yetTime limit1sMemory limit256 MB

Problem

There are nn cities and mm buses. Each bus leaves one city and arrives at a different city. You want the total fare of a trip from city AA to city BB to be as small as possible. Print that minimum fare and a route that achieves it. A route from the start city to the destination city always exists.

If several routes reach the minimum fare, pick one of them in this order.

  1. Pick the route that passes through the fewest cities.
  2. If several routes are still left, pick the one whose city numbers, listed in visiting order, form the sequence that comes first in lexicographic order.

Input

The first line contains the number of cities nn. 1n10001 \le n \le 1000

The second line contains the number of buses mm. 1m1000001 \le m \le 100000

Each of the next mm lines describes one bus with the number of its start city, the number of its destination city, and its fare, in that order. A fare is an integer that is at least 00 and less than 100000100000. No bus starts and ends at the same city, and several buses may run the same route.

The last line contains the start city AA and the destination city BB of the trip you must plan. AA and BB are different.

Output

On the first line, print the minimum fare of a trip from AA to BB.

On the second line, print how many cities the chosen route contains, counting the start city and the destination city.

On the third line, print the numbers of the cities on the chosen route in visiting order, separated by spaces. Exactly one route satisfies both tie breaking rules.