Weekly Meeting

For each member's house, add the shortest distances to two fixed nodes and sum all results, counting unreachable as -1.

Medium4Shortest pathGraphHeapInterviewNo attempts yetTime limit1sMemory limit512 MB

Problem

If you are picked for the second class of the KIST Knights, the team gathers at KIST in Wolgok, Seoul and at CR Food in Yangjae to talk things over and work together. Everyone wants to reach the meeting place quickly.

Treat each place as a node and each road as an edge, and you get a graph. You are given the node number of the house of each of the NN members, together with the node numbers of KIST and CR Food. The distance did_i of the iith member is defined as (shortest distance from the house to KIST) + (shortest distance from the house to CR Food). A shortest distance to a place that cannot be reached is defined as 1-1. For example, a member who cannot reach KIST and whose shortest distance to CR Food is 10 has distance 1+10=9-1 + 10 = 9, and a member who can reach neither KIST nor CR Food has distance 1+(1)=2-1 + (-1) = -2.

Write a program that prints the value of di\sum d_i.

Input

The first line contains the number of KIST Knights members NN, the number of places VV, and the number of roads EE. (1 ≤ NN ≤ 100, 1 ≤ VV ≤ 1000, 0 ≤ EE ≤ 10000)

The second line contains the location AA of KIST and the location BB of CR Food. (1 ≤ AA, BBVV)

The third line contains the house locations HiH_i of the NN members, separated by spaces. (1 ≤ iiNN, 1 ≤ HiH_iVV)

Each of the next EE lines contains the two endpoints aa, bb of a road and its length ll. (1 ≤ aa, bbVV, 1 ≤ ll ≤ 100) A road can be travelled in both directions. Several roads may join the same two places, and a road with aa equal to bb may appear.

Output

Print the sum of the distances of all members on one line. A shortest distance to KIST or to CR Food that cannot be reached counts as 1-1.