Racing Strategy
문제
Erika Isabella Orav is a driver in the Celsius MotoSport team of the FI (Formula Informatics) racing series. There's a new race coming up and the weather forecast is good. The team has trained hard to hone their pit stop skills, but need help figuring out the best strategy.
The upcoming race consists of laps. The team can use types of tyres with different rubber compositions. The rubber composition of a tyre determines its grip (which affects how fast the car can go) and its wear (which affects how fast the tyre deteriorates). There is unlimited amount of tyres of each type available.
When the race starts, the team's chosen tyres are already installed on the car (no pit stop needed). During the race, the driver may go to a pit stop after any lap and have the current tyres replaced with a fresh set of any type. Based on their practice, the team knows a pit stop takes them seconds.
Celsius MotoSport has carefully analysed the available tyres and determined for each type two parameters:
- --- the number of seconds it takes to drive the first lap with tyres of this type;
- --- the number of seconds by which each following lap is slower than the previous one.
Help the team find an optimal pit stop strategy to complete the race in the shortest time possible.
입력
The first line contains three space-separated integers (), (), and (). Each of the following lines describes one tyre type: two space-separated integers () and (). The tyre types are numbered in their order in the input.
출력
The first line should contain two space-separated integers, and ---the type of tyres to install for the start of the race and the number of pit stops, respectively. Each of the following lines should describe one pit stop as two integers---the number of the lap after which to make the stop (the laps are numbered ) and the type of the new tyres to install on the car. The pit stops should be listed in chronological order. If there are several optimal strategies, output any one of them.
예제
예제 1
2 2 25 45 11 40 20
2 0
예제 2
2 44 170 60 8 30 29
1 6 6 1 12 1 18 1 24 1 30 1 37 1
예제 3
3 1 25 45 10 40 20 55 10
2 0