#P7480. Minimum Fuel Cost

    ID: 20675 Type: Default 1000ms 256MiB

Minimum Fuel Cost

Minimum Fuel Cost

You are given n fuel stations on a number line. The ith station is located at \( x_i \) and has a fuel price of \( c_i \) per liter. YSGH starts with an empty fuel tank at coordinate \( s \) (which is guaranteed to have a station) and wants to travel to coordinate \( t \) (with \( s .

Note: If \( t \) does not have a fuel station, consider it as a destination point.

inputFormat

The first line contains three integers: n, s, and t (\( s < t \)).

The next n lines each contain two integers \( x_i \) and \( c_i \) representing the coordinate and fuel cost per liter at the \( ith \) fuel station. It is guaranteed that one of the fuel stations is at coordinate \( s \).

outputFormat

Output a single integer — the minimum cost required to travel from \( s \) to \( t \).

sample

3 10 20
10 5
15 4
20 3
45