Road To Savings
문제
Pat Wholes is in charge of road maintenance in Capitol City, and boy do those roads need maintenance. The road conditions are so poor that accidents have become almost a daily event, and the surviving public is in an uproar. Now while Pat would love to pave every road in the city, he also wants to keep his job. The cost of all that paving would certainly upset the mayor, who would just as certainly replace Pat if he spends too much. So now the decision is: which roads get paved and which don't? After thinking about this problem -- and his job security -- Pat came up with a bright idea: since the ultimate goal is to keep the mayor happy, he'll pave only those roads that are on a shortest path from the mayor's house to the mayor's office. There actually might be several ways for the mayor to drive to work that are equally short, but that should still leave plenty of roads that aren't on any of these paths and hence plenty of roads that don't need to be paved (hopefully). Pat's come down to your cubicle in the basement to ask you to determine the length of roads that don't need to be paved.
입력
Input starts with four positive integers () where indicates the number of intersections in the town (numbered to ), is the number of roads connecting intersections, and and are the intersections where the mayor's house and office are located, respectively. Following this are lines, each containing a triplet of numbers () indicating a two-way road exists between intersection and with length . At most one road exists between any two intersections and at least one path exists between and .
출력
Output the total length of all roads that don't need to be paved.
예제
예제 1
4 5 1 4 1 2 1 1 3 2 1 4 2 4 2 1 3 4 1
3
예제 2
4 5 1 4 1 2 1 1 3 2 1 4 1 4 2 1 3 4 1
5