Space Probe

Given a random start time in [t1,t2] and fixed measurement offsets, find the probability that no measurement lands inside any forbidden interval.

Medium7IntervalsMathSortingImplementationNo attempts yetTime limit2sMemory limit512 MB

Problem

A space probe is out of control. It starts its measurement sequence at some time tt, measured in seconds, that lies between t1t_1 and t2t_2, and nobody knows exactly when. Every start time tt in the interval [t1,t2][t_1, t_2] is equally likely.

The measurement sequence is preprogrammed and cannot be changed. It consists of nn successive measurements whose offsets m1,m2,,mnm_1, m_2, \dots, m_n are fixed. If the sequence starts at time tt, the first measurement happens at time t+m1t + m_1, the second at time t+m2t + m_2, and the last one at time t+mnt + m_n. A measurement is instantaneous, so its duration is 00 seconds.

The probe rotates in space and cannot be steered. Because of the rotation there are stretches of time during which the measuring devices point at the Sun. A measurement taken while a device points at the Sun destroys its sensors and the whole probe is lost. The trajectory and the rotation are known, so the kk time intervals [b1,e1],[b2,e2],,[bk,ek][b_1, e_1], [b_2, e_2], \dots, [b_k, e_k] during which no measurement may be taken are known as well.

Compute the probability that every measurement succeeds and the probe is not lost to solar radiation.

All given times and interval lengths are integers. Only the start time of the sequence is unknown, and it may be any real number in [t1,t2][t_1, t_2].

Input

The first line contains four integers nn, kk, t1t_1, t2t_2. Here nn is the number of measurements, kk is the number of time intervals in which no measurement may be taken, and t1t_1 and t2t_2 bound the window in which the measurement sequence can begin.

The second line contains nn integers m1,m2,,mnm_1, m_2, \dots, m_n, the offsets at which the measurements happen after the sequence begins. The sequence mim_i is strictly increasing.

Each of the following kk lines contains two integers bjb_j and eje_j that describe one forbidden interval [bj,ej][b_j, e_j]. It is guaranteed that bj<ejb_j < e_j and that the intervals do not overlap, that is, ej1<bje_{j-1} < b_j for every j>1j > 1.

  • 1n1041 \le n \le 10^4
  • 1k1041 \le k \le 10^4
  • n×k107n \times k \le 10^7
  • 0t1<t210160 \le t_1 < t_2 \le 10^{16}
  • all values m1,,mnm_1, \dots, m_n and b1,e1,,bk,ekb_1, e_1, \dots, b_k, e_k are non-negative and smaller than 101610^{16}

Values on one line are separated by single spaces.

Output

Print the probability that the probe survives, that is, the probability that no measurement falls inside any forbidden interval.

Every input value is an integer, so this probability is a rational number. Print it as an irreducible fraction in the form p/q, with no space around the slash, where q>0q > 0 and gcd(p,q)=1\gcd(p, q) = 1. Print a probability of 00 as 0/1 and a probability of 11 as 1/1.