Under construction

Still being built. Things may change

Fishnet

Time limit1sMemory limit128 MB

Summary
Threads join opposite sides of a unit square, and the program reports the largest cell area in the net they form.
Level

Medium5 of 10

Topics
Geometry, Math
Solved
No attempts yet

Problem

A fisherman named Etadokah woke up on a very small island. The night before, a storm had wrecked his ship and washed him onto this uninhabited island. Pieces of the ship lay scattered around him, and among them he found a square wooden frame and one long thread. He has to survive here until someone comes to rescue him.

To catch fish, he cut the long thread into short pieces and strained them between the pegs of the frame to make a fishnet. To tell whether the net catches small fish as well as large ones, he needs to know how big the meshes are.

The frame is a perfect square with four thin edges one meter long: a bottom edge, a top edge, a left edge, and a right edge. Each edge carries nn pegs, so there are 4n4n pegs in total. Peg positions are given as (x,y)(x, y) coordinates. The iith peg on the bottom edge is at (ai,0)(a_i, 0), the iith peg on the top edge is at (bi,1)(b_i, 1), the iith peg on the left edge is at (0,ci)(0, c_i), and the iith peg on the right edge is at (1,di)(1, d_i). The long thread is cut into 2n2n pieces of suitable length. For i=1,…,ni = 1, \dots, n, one piece is strained between (ai,0)(a_i, 0) and (bi,1)(b_i, 1), and another between (0,ci)(0, c_i) and (1,di)(1, d_i).

The strained threads and the four edges of the frame together form (n+1)2(n+1)^2 meshes. Write a program that reports the area of the largest one. Assume the thread is long enough to make the whole net and the frame is thin enough that its thickness can be ignored.

Input

The input consists of several subproblems and ends with a line containing a single zero. Each subproblem has the following format.

n
a1 a2 ... an
b1 b2 ... bn
c1 c2 ... cn
d1 d2 ... dn

The integer nn on the first line is the number of pegs on each edge. The next four lines give a1,…,ana_1, \dots, a_n, then b1,…,bnb_1, \dots, b_n, then c1,…,cnc_1, \dots, c_n, then d1,…,dnd_1, \dots, d_n, separated by single spaces. aia_i is the xx-coordinate of the iith peg on the bottom edge, bib_i is the xx-coordinate of the iith peg on the top edge, cic_i is the yy-coordinate of the iith peg on the left edge, and did_i is the yy-coordinate of the iith peg on the right edge. Every coordinate is written with 7 digits after the decimal point.

You may assume 0<n<300 < n < 30, 0<a1<a2<⋯<an<10 < a_1 < a_2 < \dots < a_n < 1, 0<b1<b2<⋯<bn<10 < b_1 < b_2 < \dots < b_n < 1, 0<c1<c2<⋯<cn<10 < c_1 < c_2 < \dots < c_n < 1, and 0<d1<d2<⋯<dn<10 < d_1 < d_2 < \dots < d_n < 1.

Output

For each subproblem, print the area of the largest mesh on its own line, rounded to 6 digits after the decimal point.

Examples1

  1. Example 1

    Input
    2
    0.2000000 0.6000000
    0.3000000 0.8000000
    0.1000000 0.5000000
    0.5000000 0.6000000
    2
    0.3333330 0.6666670
    0.3333330 0.6666670
    0.3333330 0.6666670
    0.3333330 0.6666670
    4
    0.2000000 0.4000000 0.6000000 0.8000000
    0.1000000 0.5000000 0.6000000 0.9000000
    0.2000000 0.4000000 0.6000000 0.8000000
    0.1000000 0.5000000 0.6000000 0.9000000
    2
    0.5138701 0.9476283
    0.1717362 0.1757412
    0.3086521 0.7022313
    0.2264312 0.5345343
    1
    0.4000000
    0.6000000
    0.3000000
    0.5000000
    0
    
    Expected output
    0.215657
    0.111112
    0.078923
    0.279223
    0.348958