The number of shortest paths#3146

The number of shortest paths

1 second
64 megabytes
Medium

In the city, there are squares connected by roads. The length of each road is known.

Determine the number of different shortest paths from square to square .

Input

The first line contains two integers: (the number of squares in the city) and (the number of streets). Then lines follow, each describing a street with three integers: the numbers of the two squares it connects and its length. No street connects a square to itself. The same pair of squares can be connected by multiple streets, possibly with different lengths. Each street can be used in both directions. Finally, the numbers and are given.

Constraints: 1 \leq N \leq 1000, 1 \leq M \leq 100000, 1 \leq A \leq N, 1 \leq B \leq N. The lengths of the streets are positive integers not exceeding .

Output

Output the number of shortest paths between squares and . If it is not possible to reach square from square , output 0.

Examples

Example 1

Loading
Loading