Surely You Congest
You are in charge of designing an advanced centralized traffic management system for smart cars. The goal is to use global information to instruct morning commuters, who must drive downtown from the suburbs, how best to get to the city center while avoiding traffic jams.
Unfortunately, since commuters know the city and are selfish, you cannot simply tell them to travel routes that take longer than normal (otherwise they will just ignore your directions). You can only convince them to change to different routes that are equally fast.
The city’s network of roads consists of intersections that are connected by bidirectional roads of various travel times. Each commuter starts at some intersection, which may vary from commuter to commuter. All commuters end their journeys at the same place, which is downtown at intersection 1. If two commuters attempt to start travelling along the same road in the same direction at the same time, there will be congestion; you must avoid this. However, it is fine if two commuters pass through the same intersection simultaneously or if they take the same road starting at different times.
Determine the maximum number of commuters who can drive downtown without congestion, subject to all commuters starting their journeys at exactly the same time and without any of them taking a suboptimal route.
In Figure C.1, cars are shown in their original locations. One car is already downtown. Of the cars at intersection , one can go along the dotted route through intersection , and another along the dashed route through intersection . But the remaining two cars cannot reach downtown while avoiding congestion. So a maximum of cars can reach downtown with no congestion.
Input
The first line contains three integers , and , where is the number of intersections, is the number of roads, and is the number of commuters. Each of the next lines contains three integers and describing one road, where and are the distinct intersections the road connects, and is the time it takes to travel along that road in either direction. You may assume that downtown is reachable from every intersection. The last line contains integers listing the starting intersections of the commuters.
Output
Display the maximum number of commuters who can reach downtown without congestion.