The first line contains the number of participants N, the number of vertices K on the map, and the number of roads L joining the vertices. (2≤N≤100000, 1≤K≤100000, 1≤L≤100000)
Each of the next N lines contains one number Si, the position of a person. (1≤Si≤K) It means person i stands at vertex Si. Several people may stand at the same vertex.
Each of the next L lines describes one road as Bi, Ci, Di. (1≤Bi=Ci≤K, 1≤Di≤5000) It means there is a road of length Di km between vertex Bi and vertex Ci. Roads can be travelled in both directions, and the same two vertices may be joined by more than one road.