ICAMPSEQ - IOICamp Sequence

no tags 

Let's say we have 4 N-elements sequences of real numbers: A[], B[], C[], D[] .
Funtion F(i, j) is defined: F(i, j) = |Ai - Aj| + |Bi - Bj| + |Ci - Cj| + |Di - Dj| (1 ≤ i, j ≤ N).
Your task is very easy: you have to find the maximum of F(i, j).

Input

The first line: N (N ≤ 100000).
Following are N lines: the i-th line contains four real numbers Ai, Bi, Ci, Di. (-109 ≤ Ai, Bi, Ci, Di ≤ 109)

Output

Only one line is the maximum of F(i, j).
(The result takes exactly 3 decimal places)

Example

Input:
2
1.0 1.0 2.0 0.5
1.0 1.0 0.5 2.0

Output:
3.000

hide comments
Shaka Shadows: 2010-04-22 13:58:08

Time limit is too strict!!! My solution runs in O(n) and gets TLE.

Nghia Nguyen Hoang: 2009-10-08 08:35:05

3.236

monkeyvu: 2009-11-21 13:23:00

what will be displayed when result is 3.23567? It will be 3.235 or 3.236?


Added by:Nghia Nguyen Hoang
Date:2007-09-18
Time limit:0.100s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:IOICamp and Ms. Thanh Vy Hua Le