#! /usr/bin/env pypy3

import argparse
import sys
from collections import Counter
from bisect import bisect_left
from itertools import combinations
from math import dist

parser = argparse.ArgumentParser()
parser.add_argument("in_file", type=argparse.FileType("r"))
parser.add_argument("correct_file", type=argparse.FileType("rb"))
parser.add_argument("check_file", type=argparse.FileType("rb"))
args = parser.parse_args()

n, m, k, h = map(int, args.in_file.readline().split())
starts = list(map(int, args.in_file.readline().split()))
ends = list(map(int, args.in_file.readline().split()))
coefficients = list(map(float, args.in_file.readline().split()))

def bad(msg):
    print(msg, file=sys.stderr)
    print(0)
    sys.exit()

def pe(msg):
    bad("Presentation error: " + msg)

def wa(msg):
    bad("Wrong answer: " + msg)

def iter_ys(xys, h):
    cy = h
    for x, y in xys:
        while y != cy:
            cy -= 1
            yield None
        yield x, y

    while cy >= 0:
        cy -= 1
        yield None

    
def grade(data_file):
    # Read the data
    points = []
    
    sum_nums = 0
    for _ in range(n):
        try:
            num = int(data_file.readline().strip())
        except ValueError:
            pe("invalid number of points")
        
        if num < 0:
            pe("invalid number of points")
        
        sum_nums += num
        if sum_nums > 2 * 10**6:
            wa("too many points")
        
        group = []
        
        for _ in range(num):
            try:
                x, y = map(int, data_file.readline().strip().split())
            except ValueError:
                pe("invalid point")
        
            if abs(x) > 10**6 or not 0 <= y <= h:
                wa("point coordinate out of range")
        
            group.append((x, y))

        points.append(group)
    
    while True:
        l = data_file.readline()
        if l == b"":
            break
        elif l.strip() != b"":
            pe("extra data at the end of the file")
    
    # Data read
    data_file.close()
    
    for group in points:
        group.sort(key=lambda xy: xy[1], reverse=True)
    
    iters = [iter_ys(group, h) for group in points]
    
    # Check the cloud line
    starts1 = []
    for it in iters:
        xy = next(it)
        if xy is None:
            wa("a bolt doesn't start in the cloud")
        
        starts1.append(xy[0])

        xy = next(it)
        if xy is not None:
            wa("a bolt has multiple points in the cloud")
    
    if starts1 != starts:
        wa("bolts don't start at the specified coordinates")

    # Find all the splitting points, terminals, segments
    # and check the constraints
    splits = set()
    terminals = set()
    prev_xs = set(starts1)
    segments = [set() for _ in range(n)]
    prev_group_xs = [{x} for x in starts1]
    prev_segment_mem = {x: (0, (x, h)) for x in starts1}
    for y in range(h)[::-1]:
        xs = set()
        xs_i = []
        curr_group_xs = []
        segment_mem = {}
        for bi, (it, prev_g_xs) in enumerate(zip(iters, prev_group_xs)):
            group_xs = set()
            used_prev_xs = set()
            for xy in it:
                if xy is None:
                    break
                x, _ = xy
                
                if x in xs:
                    wa("overlapping points")
                
                if all(cx not in prev_g_xs for cx in [x - 1, x + 1]):
                    wa("a point doesn't have a valid previous point")
                
                if all(cx in prev_xs for cx in [x - 1, x + 1]):
                    if any(cx not in prev_g_xs for cx in [x - 1, x + 1]):
                        wa("a point is too close to another bolt")
                    else:
                        wa("a point has multiple valid previous points")
                
                prev_x = next(cx for cx in [x - 1, x + 1] if cx in prev_xs)
                dx = x - prev_x
                end_prev = False
                if prev_x in used_prev_xs:
                    # Split
                    splits.add((prev_x, y + 1))
                    
                    segment_mem[x] = dx, (prev_x, y + 1)
                    
                    # Make sure the other point knows that it is
                    # in a new segment
                    ox = x - 2 * dx
                    segment_mem[ox] = -dx, (prev_x, y + 1)
                    end_prev = True
                else:
                    used_prev_xs.add(prev_x)
                    if prev_segment_mem[prev_x][0] not in [dx, 0] or (prev_x, y + 1) in splits:
                        # Turn / split
                        segment_mem[x] = dx, (prev_x, y + 1)
                        end_prev = True
                    else:
                        segment_mem[x] = dx, prev_segment_mem[prev_x][1]
                
                if end_prev:
                    # End the previous segment
                    seg_a = prev_segment_mem[prev_x][1]
                    seg_b = (prev_x, y + 1)
                    if seg_a != seg_b:
                        segments[bi].add((seg_a, seg_b))
                
                xs.add(x)
                xs_i.append((x, bi))
                group_xs.add(x)
            
            if len(group_xs) == 0:
                wa("a bolt ends before reaching the ground")
            
            for x in prev_g_xs - used_prev_xs:
                # Terminal
                terminals.add((x, y + 1))
                # Save the segment
                segments[bi].add((prev_segment_mem[x][1], (x, y + 1)))
            
            if y == 0:
                # End all of the segments on the ground
                for x in group_xs:
                    segments[bi].add((segment_mem[x][1], (x, y)))
            
            curr_group_xs.append(group_xs)
        
        xs_i.sort()
        for i in range(len(xs_i) - 1):
            x0, bi0 = xs_i[i]
            x1, bi1 = xs_i[i + 1]
            if bi0 != bi1 and x1 - x0 < 2:
                wa("a point is too close to another bolt")
        
        prev_xs = xs
        prev_group_xs = curr_group_xs
        prev_segment_mem = segment_mem
        
        if n + len(splits) > m + k:
            # >:(
            wa("too many splits")

    if len(terminals) != k:
        wa("wrong number of terminal points in the air")
    
    if len(prev_xs) != m:
        wa("wrong number of terminals on the ground")
        
    if prev_xs != set(ends):
        wa("wrong terminals on the ground")

    cost_a = 0
    cost_b = 0
    for seg in segments:
        count = Counter()
        for (_, y0), (_, y1) in seg:
            dy = y0 - y1
            cost_a += 2 * dy**2
            count[dy] += 1
        cost_b += sum(c**2 for c in count.values())
    
    cost_c = 0.0
    iters = [iter_ys(group, h) for group in points]
    lows = [low for seg in segments for _, low in seg]
    lows.sort(key=lambda xy: xy[1], reverse=True)
    iter_points = iter_ys(lows, h)
    for y in range(h + 1)[::-1]:
        xs = []
        for it in iters:
            for xy in it:
                if xy is None:
                    break
                x, _ = xy
                xs.append(x)
        xs.sort()
        for xy in iter_points:
            if xy is None:
                break
            x, _ = xy
            ci = bisect_left(xs, x)
            d = 10**9

            if ci > 0:
                d = min(d, x - xs[ci - 1])
            if ci + 1 < len(xs):
                d = min(d, xs[ci + 1] - x)
            cost_c += 1 / d**2
    
    cost_d = sum(1 / y for _, y in terminals)
    cost_e = 0.0
    terminals_l = list(terminals)
    for xy1, xy2 in combinations(terminals_l, 2):
        d = dist(xy1, xy2)
        cost_e += (d - 10)**2 / d**4
    
    return cost_a, cost_b, cost_c, cost_d, cost_e


def evaluate(g):
    return sum(a * b for a, b in zip(coefficients, g))
    
g2 = grade(args.check_file)
e2 = evaluate(g2)

print("Costs:", end=" ", file=sys.stderr)
for name, v, c in zip("abcde", g2, coefficients):
    print(f"{name}: {v:.3f} (x{c:.10})", end="; ", file=sys.stderr)
print(f"Total weighted: {e2:.3f}", file=sys.stderr)

result = 1 / e2 * 1e14
print(f"{result:.5f}")
