Sand Art

No attempts yetTime limit3sMemory limit256 MB

Problem

A booth at a craft fair lets children make sand art. The usual container is a bottle packed with layers of colored sand. This year the container is a glass box.

Seen from the front the box is a rectangle, and its thickness is exactly 1, so the volume of sand in a region equals the area of that region on the front face. Inside the box, n1n-1 vertical dividers split the interior into nn sections. The picture below shows a box split into 4 sections by 3 dividers.

A glass box split into 4 sections by 3 vertical dividers

For every section and every color, a child gives the smallest and the largest amount of that color the section may hold. Sand settles flat inside a section, so the height of a section is the volume of sand in it divided by the width of the section. Make the artwork as even as possible: minimize the difference between the height of the tallest section and the height of the shortest section.

Input

The first line holds the integers nn, mm, ww, hh, separated by spaces.

  • nn (2n2002 \le n \le 200) is the number of sections.
  • mm (1m2001 \le m \le 200) is the number of sand colors.
  • ww and hh (1w,h50001 \le w, h \le 5000) are the width and the height of the box. Its thickness is always 1.

The second line holds mm real numbers vv (0<vw×h0 < v \le w \times h) with at most 3 decimal places. The jjth value is the volume of sand color jj. You do not have to use all of the sand, but every section minimum must be met.

The third line holds n1n-1 real numbers xx (0<x<w0 < x < w) with at most 3 decimal places, in increasing order. Each value is the distance from the left wall to a divider.

Each of the next nn lines holds mm real numbers min\min (0minw×h0 \le \min \le w \times h) with at most 3 decimal places. The jjth value on the iith line is the smallest amount of sand color jj to put in section ii.

Each of the next nn lines holds mm real numbers max\max (0maxw×h0 \le \max \le w \times h) with at most 3 decimal places. The jjth value on the iith line is the largest amount of sand color jj to put in section ii, and minijmaxij\min_{ij} \le \max_{ij}.

Output

Print, on one line, the smallest possible difference between the tallest and the shortest section height, rounded to exactly 3 digits after the decimal point. A distribution that satisfies every constraint in the input always exists.