Statisticians

No attempts yetTime limit1sMemory limit128 MB

Problem

Statisticians like to compute many statistics. One simple measure is the mean: the sum of all values divided by the number of values. Another is the median: the middle value once all values have been sorted. If there is an even number of values, the median is the mean of the two middle values.

Such measures can describe, for example, the population of a country or part of it. Anne Jensen, Maria Virtanen, Jan Hansen, Erik Johansson and Jón Þórsson want to measure statistically how many statisticians there are in the Nordic countries — more precisely, how many there are per unit area. Because the population is spread out, they use a new measurement called MAD (Median of All Densities):

  1. Overlay a square grid on the map.
  2. For every axis-aligned rectangle of grid cells whose area lies within the allowed range, compute its density: the mean number of statisticians per unit area (the total inside the rectangle divided by its area).
  3. Repeat for every possible rectangle; the MAD is the median of all these densities.

Given the grid and the allowed range of rectangle areas, compute the MAD.

Input

The first line contains two space-separated integers $h$ and $w$, the height and width of the grid ($1 \le h \le 140$, $1 \le w \le 120$).

The second line contains two space-separated integers $a$ and $b$, the lower and upper bounds on the allowed rectangle area; every considered rectangle has area in $[a, b]$, with $1 \le a \le b \le w \times h$.

Each of the next $h$ lines contains $w$ space-separated integers $s$, the number of statisticians in each cell of the grid ($0 \le s \le 10000$).

It is guaranteed that at least one rectangle has area within $[a, b]$.

Output

Print a single line containing the MAD — the number of statisticians per unit area — rounded to three decimal places.