#P17385. [PacNW 2025] Honkai Stress Relief

[PacNW 2025] Honkai Stress Relief

Problem Description

After finishing her last exam, Audrey decides to relax by playing Honkai: Star Rail.

On each of the next nn days, she plays during an open time interval (s,e)(s,e). Her smartwatch checks her stress once per day. It independently chooses a real time t0t_0 uniformly at random from the open interval (a,b)(a,b). If s<t0<es<t_0<e, the watch reports that Audrey is relaxed; otherwise, it reports that she is stressed. The values aa and bb are the same every day.

Compute the probability that the watch reports Audrey as stressed on at least one day.

Input Format

The first line contains three integers nn, aa, and bb (1n201\le n\le20, 1a<b501\le a<b\le50).

Each of the next nn lines contains two integers ss and ee (1s<e501\le s<e\le50), Audrey's open playing interval on that day.

Output Format

Output the probability that Audrey is reported as stressed on at least one day. An answer is accepted if its absolute or relative error is at most 10610^{-6}.

2 19 39
18 31
28 50
0.67