#P9100. Mines Explosion Experiment
Mines Explosion Experiment
Mines Explosion Experiment
There are \(n\) mines placed along a straight line at distinct positions. Each mine has its own explosion radius. When a mine explodes (either manually or by chain reaction), it automatically detonates every mine whose position \(x\) satisfies \(\lvert x_a - x_b \rvert \leq r_b\), where \(r_b\) is the explosion radius of the exploding mine.
Sergeant Bytomir performs an experiment. He selects an arbitrary subset (possibly empty) of mines and manually detonates all of them simultaneously. When a mine is detonated manually, it triggers a chain reaction: every mine that lies within the explosion radius of any exploding mine (whether triggered manually or automatically) will also explode. The final experimental outcome is the set of all mines that exploded. Two outcomes are considered identical if the set of exploded mines is the same.
Determine the number of distinct explosion outcomes modulo \(10^9+7\). Note that even if two different manually triggered subsets produce the same final set of exploded mines, they are counted as one outcome.
inputFormat
The first line contains an integer \(n\) — the number of mines.
Each of the following \(n\) lines contains two integers \(x_i\) and \(r_i\), representing the position and explosion radius of the \(i\)-th mine respectively.
outputFormat
Output a single integer: the number of distinct explosion outcomes modulo \(10^9+7\).
sample
3
1 1
3 1
6 1
6