NOIP '99 P3 - Traveller's Budget
View as PDFA traveller wants to drive from one city to another with minimum cost (assuming the gas tank is empty at the beginning). Given the distance between two cities is , the capacity of the car's fuel tank is 
 (in litres), the distance that a litre of gasoline can travel is 
, the gas price per litre at the starting point is 
, and there are 
 gas stations along the way, the distance from the gas station 
 to the starting point is 
, and the price of gasoline per litre is 
 (
). Round your answer to two decimal places. If the destination cannot be reached, output 
No Solution.
Constraints
Input Specification
The first line contains five space-separated numbers, representing , 
, 
, 
 and 
, respectively.
The next  lines contain two numbers 
, the distance from the starting point to the gas station 
, and 
, the price of gasoline per litre at the gas station 
.
Output Specification
Output the minimum cost required, rounded to two decimal places. If the destination cannot be reached, output No Solution.
Sample Input
275.6 11.9 27.4 2.8 2
102.0 2.9
220.0 2.2
Sample Output
26.95
Problem translated to English by .
Comments