Rar the Cat and his friend go home together in a taxi after a party. Rar the Cat lives in a town that can be modelled by a graph with nodes and bidirectional weighted edges. The party takes place at node , Rar the Cat's friend lives at node and Rar the Cat lives at node . Rar the Cat decides to send his friend home before going home himself, of course offering to pay for the trip. Below are the fares:
- Flag-down (fixed cost): $3
- Each kilometre for the first 10 kilometres: $2
- Each kilometre after 10 kilometres: $1
Find the minimum cost required to do so, or state that it is impossible.
Input Specification
The first line of input will contain five integers .
The following lines will contain three integers on each line, representing an edge connecting two nodes and with weight .
Output Specification
If it is not possible for Rar the Cat to send his friend home and then return home, output Nooooooooo!!!
.
If it is possible for Rar the Cat to send his friend home but not possible for him to return home, output the minimum cost required to send his friend home on one line, then output Yippee!!!
on the next line as he would have an excuse to not go home and stay overnight at his friend's place.
If it is possible for Rar the Cat to send his friend home and then return home, output the minimum cost required.
Constraints
Subtask 1 [100%]
Subtask 2 [0%]
Sample test cases.
Sample Input 1
5 4 0 2 2
0 1 1
1 2 1
2 3 1
3 4 1
Sample Output 1
7
Sample Input 2
5 1 0 1 2
0 1 5
Sample Output 2
13
Yippee!!!
Sample Input 3
3 1 0 2 1
0 1 1
Sample Output 3
Nooooooooo!!!
Comments