Output
In the first line print the remainder after dividing the length of the shortest path by
1000000007(109+7) if the path exists, and
-1 if the path doesn't exist.
If the path exists print in the second line integer
k − the number of vertices in the shortest path from vertex
s to vertex
t; in the third line print
k space-separated integers − the vertices of the shortest path in the visiting order. The first vertex should be vertex
s, the last vertex should be vertex
t. If there are multiple shortest paths, print any of them.
Note
A
path from vertex
s to vertex
t is a sequence
v0, ...,
vk, such that
v0=s,
vk=t, and for any
i from 0 to
k-1 vertices
vi and
vi+1 are connected by an edge.
The
length of the path is the sum of weights of edges between
vi and
vi+1 for all
i from 0 to
k-1.
The
shortest path from
s to
t is the path which length is minimum among all possible paths from
s to
t.