Trains#4422

Trains

1 second
128 megabytes
Medium

Due to an increase in accidents on the Bremstadt–Rosenheim railway line, the railway management has decided to change the train timetable. A thorough analysis of the railway track condition has shown that the optimal schedule with station stops is as follows: initially, the train travels for t_1 minutes at a speed of v_1 meters per minute, then for t_2 minutes at v_2 meters per minute, ..., and finally for t_n minutes at v_n meters per minute. During some intervals, the train may be stationary (speed equals ).

According to current train safety regulations, the distance between the locomotives of two consecutive trains must be at least meters. Determine the minimal permissible interval in minutes between train departures that allows them to follow this schedule without approaching each other dangerously.

Input

The first two lines contain two natural numbers: the minimal permissible distance and the number of route segments (100 \leq l \leq 10000, 1 \leq n \leq 10000). Next follow pairs of integers t_i and v_i (1 \leq t_i \leq 1000, 0 \leq v_i \leq 1000), defining the train's schedule.

Output

Output the required interval between train departures in minutes, with at least three decimal places.

Examples

\begin{example}\exmp{1000330 10010 010 100}{20.000}%\end{example}

Example 1

Loading
Loading