Bessie is returning from a long trip abroad, and Farmer John wants to mount a nice "Welcome Home" banner for her arrival. Farmer John's field has integer dimensions $M \times N$ ($1 \le M, N \le 100{,}000$). He has installed a post at every point with integer coordinates, using a coordinate system in which $(0, 0)$ is the lower-left corner and $(M, N)$ is the upper-right corner. Of these $(M + 1) \times (N + 1)$ posts, Farmer John must choose two as the endpoints of the banner.
Being a perfectionist, Farmer John insists that the banner be perfectly straight: for the two chosen posts, no other post may lie on the straight line segment between them. For instance, posts $(0, 0)$ and $(2, 0)$ cannot both be chosen, because post $(1, 0)$ lies between them.
In addition, the banner's length must be at least $L$ and at most $H$ ($1 \le L \le H \le 150{,}000$), where the length is the Euclidean distance between the two endpoints.
The banner is reversible, so swapping its two endpoints yields the same way of hanging it. Count the number of distinct ways Farmer John can hang the banner. Because this number can be very large, report it modulo $B$ ($1 \le B \le 1{,}000{,}000{,}000$).
A single line with five space-separated integers: $M$, $N$, $L$, $H$, and $B$.
A single line with one integer: the number of valid ways to hang the banner, taken modulo $B$.