Matrix

No attempts yetTime limit2sMemory limit256 MB

Problem

After years of searching, Morpheus found The One: a computer programmer named Thomas A. Anderson, known to his friends as Neo. On the way back from the Oracle, Morpheus reached the real world first, and an agent destroyed the telephone before Neo could pick it up. Neo has not reached his full potential yet, so he has to run to another telephone without fighting an agent.

The Matrix world has NN locations, and Neo stands at location 00. There are MM paths connecting locations. Every path is bidirectional and takes a fixed amount of time to walk. You know where the agents are and where the telephones are.

You do not know how the agents move, so assume the worst case. If some agent can reach location vv in DvD_v minutes at the earliest, then from time DvD_v on there may be an agent standing at vv. Neo may therefore pass only through locations he reaches strictly before DvD_v. Arriving exactly at time DvD_v counts as meeting an agent. The same rule applies to a location that holds a telephone: if Neo and an agent reach the telephone at the same time, Neo has to fight the agent before picking up the phone.

Neo starts at location 00 at time 00 and never stops on the way. If he can reach some telephone safely, report the earliest arrival time among those telephones. If he cannot reach any telephone safely, report that instead.

Input

The first line contains the number of test cases TT (1T1001 \le T \le 100).

The first line of each test case contains four integers NN, MM, NANA, NTNT: the number of locations, the number of paths, the number of agents, and the number of telephones. (3N10003 \le N \le 1000, 1M1000001 \le M \le 100000, NA>0NA > 0, NT>0NT > 0, NA+NT<N1NA + NT < N - 1)

Each of the next MM lines contains three integers uu, vv, mm (0u,v<N0 \le u, v < N, 1m301 \le m \le 30), meaning that a path connects location uu and location vv and takes mm minutes to walk. Several paths may connect the same pair of locations, and uu may equal vv.

The next line contains the NANA locations of the agents.

The last line contains the NTNT locations of the telephones.

Location 00 holds no agent and no telephone. No location holds both an agent and a telephone. The sum of NN over all test cases is at most 2000020000, and the sum of MM is at most 200000200000.

Output

Print one line per test case. If no telephone can be reached safely, print Neo may fight an Agent. Otherwise print the minimum time in minutes needed to get out of the Matrix, as an integer.