The Road to School
The city of oil workers is composed of N numbered squares, with some pairs connected by streets of known lengths. No street connects a square to itself, and each street can be traveled in both directions. Additionally, there is at most one street between any two squares.
All residents' houses and city institutions, including the school, are located on these squares. The school is specifically located on square number 1. Following a long-standing tradition, many students prefer to walk to school together. K boys from the same class decided to uphold this tradition. However, since they live on different squares, they must walk part of the way separately. Due to the climate, each boy travels from home to school via the shortest possible route.
Your task is to write a program that determines the maximum distance the boys can walk together.
Input
The first line of the input contains three integers: N, M, and K (1 ≤ N ≤ 1000, 1 ≤ M ≤ 10000, 1 ≤ K ≤ 100). Here, N is the number of squares, M is the number of roads, and K is the number of classmates. The second line lists K integers, each representing the square number where a classmate's house is located. The following M lines describe the roads, each specified by three numbers: the two connected squares and the road's length. The length is a natural number not exceeding 1000. All numbers are separated by spaces. It is guaranteed that each of the K students can reach the school from their home using the city's roads.
Output
The output should be the maximum distance that the classmates can walk together on their way from their homes to school.