Contests | Virtual Contests | Problems | Submit | Runs Status | Rank List | Forum |

Time Limit: 1.0 Seconds Memory Limit: 65536K

Total Runs: 414 Accepted Runs: 166 Multiple test files

One cow from each of *N* farms (1 ≤ *N* ≤ 1000) conveniently numbered
1..*N* is attending the big cow party to be held at farm #*X* (1 ≤ *X*
≤ *N*). Each of *M* (1 ≤ *M* ≤ 100,000) bidirectional roads connects
one farm to another. It is always possible to travel from one farm
to another on the roads. Traversing road *i* requires *T*_{i} (1 ≤ *T*_{i}
≤ 100) units of time. One or more pairs of farms might be directly
connected by more than one road.### Input

* Line 1: Three space-separated integers, respectively: *N*, *M*, and *X*### Output

* Line 1: One integer: the minimum amount of time the party must be
suspended.### Sample Input

### Sample Output

### Input Details

Four cows; eight roads; party at farm 2.
### Output Details

Direct paths connects farm 2 to each of the other farms (to farm
1: 7 and 3; to farm 3: 1; to farm 4: 2). The longest path is length
3, so the round-trip time is 6.

After all the cows gathered at farm #*X*, they realized that every
single cow left her party favors back at the farm. They decided to
suspend the party and send all the cows back to get the party favors.
The cows all travel optimal routes to their home farm and back to
the party. What is the minimum number of time units the party must
be suspended?

* Lines 2..*M* + 1: Line *i* + 1 describes road *i* with three space-separated
integers, respectively: *A _{i}*,

4 8 2 1 2 7 1 3 8 1 4 4 2 1 3 2 3 1 3 1 2 3 4 6 4 2 2

6

Maintance:Fxz. Developer: SuperHacker, G.D.Retop, Fxz