题目描述
Problem Description
In biology class, Xiao F learned about food chains and food webs.
He learned that energy is gradually reduced. For example, in a food chain, the energy transfer efficiency between two linked organisms $A \rightarrow B$ (meaning $B$ eats $A$) is at most $\frac{1}{5}$; and studying interspecies relationships can direct energy to the most beneficial part for humans.
Now, Xiao F wants to study the energy flow relationship, so he creates an ecological system in his mind.
In this ecological system, there are $n+2$ species of organisms, where $0$ is the producer, and the energy flowing through the entire ecosystem is fixed by it; you are the greedy top predator $n + 1$, capable of preying on all organisms; other predators $[1, n]$ each have their preferences and will only prey on organisms with numbers in $[0, r_i]$. Due to the natural order of strength and weakness, the above relationships satisfy $r_i \leq r_{i + 1}(1 \leq i < n)$, $r_i < i(1 \leq i \leq n)$.
Each animal needs to consume at least $a_i$ units of energy to survive; the energy consumed by an organism can be passed on to its predator, but the transfer efficiency does not exceed $\frac{1}{5}$. That is, assuming the animal captures $b_i$ units of energy, and the total energy $c_i$ obtained by all predators that prey on it, then:
* $b_i \geq a_i$
* $c_i \leq \frac{1}{5} b_i$
You want to know, under the condition that all organisms survive, what is the maximum energy you can obtain in the optimal situation.
Input Format
The first line of input contains two integers $n, a_0(1 \leq n \leq 10^5, 1 \leq a_0 \leq 10^9)$. $a_0$ is the fixed energy value of the producer.
The next $n$ lines, each containing two positive integers, represent $a_i, r_i(1 \leq a_i \leq 10^9)$.
The data guarantees that $0 \leq r_i < i, r_i \leq r_{i + 1}$.
Output Format
Output a single floating-point number, representing the maximum energy you, the top predator, can obtain. If it is not possible for all organisms to survive (including yourself), output $-1$.
Your answer is considered correct if the relative or absolute error with the reference answer does not exceed $10^{-8}$. If your program is correct, you do not need to consider precision issues.
Sample Input and Output
Sample Input #1
2 9
1 0
1 1
Sample Output #1
0.2000000
Sample Input #2
2 9
1 0
1 0
Sample Output #2
-1
Sample Input #3
2 10
1 0
1 0
Sample Output #3
0.4000000
Notes
Sample 1 Explanation
In the optimal situation:
* Predator 1 preys on producer 0, captures 5 units of energy, with a transfer efficiency of $\frac{1}{5}$, obtaining 1 unit of energy.
* Predator 2 preys on producer 0, captures 4 units of energy, with a transfer efficiency of $\frac{1}{5}$, obtaining 0.8 units of energy.
* Predator 2 preys on predator 1, captures 1 unit of energy, with a transfer efficiency of $\frac{1}{5}$, obtaining 0.2 units of energy.
Poor you can only capture the energy of predator 2, capturing 1 unit of energy, obtaining 0.2 units of energy.
Sample 2, 3 Explanation
Since predator 2 starts dieting and stops eating meat (or maybe it can't beat predator 1), the required producer energy changes from 9 units to 10 units.
Subtasks
Subtask $1(21 \mathrm{pts}) : n \leq 100$;
Subtask $2(89 \mathrm{pts}) : n \leq 10^5$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分