Bank Robbery

Arsène Lupin is a gentleman thief and a master of disguise; he has been responsible for heists no right-minded individual would believe possible. He is also, very much, the ladies’ man. Lupin is about to drop everything he is currently doing to come to the aid of some of his friends who are planning a bank robbery in the infamous Kingdom of Aksum: his friends have identified the location of banks they are willing to rob, as well as the location of the police stations that serve the city. As a matter of fact, they have come up with a map of the entire city in which bidirectional roads connecting sites and traveling times between sites have been detailed. Despite the criminal nature of his activities, Lupin has a strict code he follows in order to avoid tainting his reputation: he has never been caught by the authorities. In order to help his friends and, at the same time, keep his well-earned reputation, Lupin is wondering which banks can be robbed so that they are the ones furthest away from any police station serving the Kingdom of Aksum. Input The input consists of several test cases. Each test case begins with 4 blank-separated integer numbers N,M,B,P (1 ≤ N ≤ 1000, 0 ≤ M, 1 ≤ B ≤ N, 0 ≤ P < N) denoting, respectively, the number of sites in the city, the number of roads in the city, the number of banks in the city, and the number of police stations in the city. The next M lines contain each three blank-separated integers U,V,T (0 ≤ U < N, 0 ≤ V < N, U ̸= V, 0 ≤ T ≤ 10000) denoting that there is a road between sites U and V which takes T time units to transit. The next line contains B blank-separated and pairwise distinct site numbers identifying the location of banks. If P ̸= 0, then follows a line with P blank-separated and pairwise distinct site numbers identifying the location of police stations. You can assume that a bank and a police station are never located at the same site. Output For each test case, output two lines. The first line should contain two blank-separated figures S,E denoting, respectively, the number of banks furthest away from any police station and the minimum time it would take to transit from any police station to these banks. If E is not an integer number, then output ‘*’ instead. The second line should contain S blank-separated integers, in ascending order, corresponding to the sites where banks are located with minimum time from any police station being exactly E time units. Sample Input 5621 015 022 136 141 234 343 14 2 5421 015

2/2 022 136 234 14 2 5622 015 022 136 141 234 343 14 23 Sample Output 27 14 1* 4 14 1