문제
Bessie is conducting a business trip in Bovinia, where there are
Mooving between two cities via a road takes one day. Preparing for the trip is expensive; it costs
What is the maximum amount of moonies Bessie can make in one trip? Note that it may be optimal for Bessie to visit no cities aside from city 1, in which case the answer would be zero.
SAMPLE INPUT:
3 3 1
0 10 20
1 2
2 3
3 1SAMPLE OUTPUT:
24The optimal trip is
Problem credits: Richard Peng and Mark Gordon
입력
The first line contains three integers
The second line contains the
The next
출력
A single line with the answer.