Extended Manhattan Distance

Time Limit: 1000 ms Memory Limit: 65536 KiB

Problem Description

Input

Output

Sample Input

0 0 4 4 -1 0 5 3
0 0 4 4 2 2 5 3
0 0 0 0 0 0 0 0

Sample Output

7.650
3.414

Hint

 

Source

2009 Mid-Atlantic Regional Programming Contest