Problem G
Ginger Candy
Mr. G is one of the most excellent students in North River High School for Gifted Students. Despite having impressive performance in a programming competition and making it to the next round, he was not totally happy since his best friend did not get such a great achievement. In order to appease the poor girl, Mr. G has to deal with a very hard challenge: Buy her some ginger candies!
The road system in North River
province consists of
Using his humble knowledge in Physics, Mr. G calculates the amount of energy he needs to
spend as follow: Let
Help him to satisfy his friend with the minimum amount of energy.
Input
-
The first line contains three integers
, , , the number of junctions, the number of roads and the predefined constant Mr. G uses to calculate the amount of energy, respectively ( , , ). -
In the next
lines, each contains three integers , , ( , , ), meaning that there is a road connecting two junctions and , which sells ginger candies.
It is guaranteed that all
Output
Write one integer denoting the minimum amount of energy Mr. G has to spend. If there is no route satisfying the condition, output Poor girl instead.
Sample Input 1 | Sample Output 1 |
---|---|
7 7 10 1 2 1000000 2 3 2000000 3 4 3000000 4 5 4000000 5 6 5000000 6 7 6000000 7 1 7000000 |
49000000000070 |
Sample Input 2 | Sample Output 2 |
---|---|
6 6 7 1 3 1000000 3 5 3000000 5 1 5000000 2 4 2000000 4 6 4000000 6 2 6000000 |
25000000000021 |
Sample Input 3 | Sample Output 3 |
---|---|
5 4 1 1 2 22081999 1 3 28021999 2 4 19992208 2 5 19992802 |
Poor girl |