← Home
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

type Interval struct {
	l, r float64
}

var (
	K   float64
	C1  float64
	C3  float64
	C4  float64
	EPS = 1e-12
)

func sort6(a *[6]float64) {
	for i := 0; i < 6; i++ {
		for j := i + 1; j < 6; j++ {
			if a[j] < a[i] {
				a[i], a[j] = a[j], a[i]
			}
		}
	}
}

func term(c, u float64) float64 {
	if c == 0 {
		return 0
	}
	return c * c / (2 * (u + c))
}

func pairIntegral(a, b, c, d float64) float64 {
	if c > b*K || a > d*K {
		return 0
	}
	xs := [6]float64{a, b, c / K, d / K, K * c, K * d}
	sort6(&xs)
	res := 0.0
	d2 := d * d
	for i := 0; i < 5; i++ {
		L := xs[i]
		R := xs[i+1]
		if L < a {
			L = a
		}
		if R > b {
			R = b
		}
		if R-L <= EPS {
			continue
		}
		mid := (L + R) * 0.5
		uk := mid / K
		ku := mid * K

		lo := c
		if uk > lo {
			lo = uk
		}
		hi := d
		if ku < hi {
			hi = ku
		}
		if hi-lo <= EPS {
			continue
		}

		lowerScaled := uk > c+EPS
		upperScaled := ku < d-EPS

		switch {
		case !lowerScaled && upperScaled:
			res += (C1*R + term(c, R)) - (C1*L + term(c, L))
		case !lowerScaled && !upperScaled:
			res += (-d2/(2*(R+d)) + term(c, R)) - (-d2/(2*(L+d)) + term(c, L))
		case lowerScaled && upperScaled:
			res += C4 * (R - L)
		default:
			res += (-d2/(2*(R+d)) - C3*R) - (-d2/(2*(L+d)) - C3*L)
		}
	}
	if res < 0 && res > -1e-10 {
		return 0
	}
	return res
}

func sideSum(arr []Interval) float64 {
	sort.Slice(arr, func(i, j int) bool {
		return arr[i].l < arr[j].l
	})
	res := 0.0
	for i := 0; i < len(arr); i++ {
		limit := arr[i].r * K
		for j := i; j < len(arr); j++ {
			if arr[j].l > limit {
				break
			}
			v := pairIntegral(arr[i].l, arr[i].r, arr[j].l, arr[j].r)
			if j == i {
				res += v
			} else {
				res += 2 * v
			}
		}
	}
	return res
}

func main() {
	in := bufio.NewReaderSize(os.Stdin, 1<<20)
	out := bufio.NewWriterSize(os.Stdout, 1<<20)
	defer out.Flush()

	var n int
	var h, f int
	fmt.Fscan(in, &n, &h, &f)

	hf := float64(h)
	ff := float64(f)
	d := ff - hf

	K = (ff + hf) / d
	C1 = K * K / (2 * (1 + K) * (1 + K))
	C3 = 1 / (2 * (1 + K) * (1 + K))
	C4 = (K - 1) / (2 * (1 + K))

	plus := make([]Interval, 0, n)
	minus := make([]Interval, 0, n)
	totalLen := 0.0

	for i := 0; i < n; i++ {
		var l, r int
		fmt.Fscan(in, &l, &r)
		lf, rf := float64(l), float64(r)
		totalLen += rf - lf

		if rf > 0 {
			pl := lf
			if pl < 0 {
				pl = 0
			}
			if pl < rf {
				plus = append(plus, Interval{pl, rf})
			}
		}
		if lf < 0 {
			nr := rf
			if nr > 0 {
				nr = 0
			}
			ml, mr := -nr, -lf
			if ml < mr {
				minus = append(minus, Interval{ml, mr})
			}
		}
	}

	topBottom := 4 * ff * hf / d * totalLen
	overlapConst := 4 * ff * ff / d
	overlap := overlapConst * (sideSum(plus) + sideSum(minus))
	ans := topBottom - overlap
	if ans < 0 && ans > -1e-8 {
		ans = 0
	}

	fmt.Fprintf(out, "%.10f\n", ans)
}