Limits 1s, 512 MB

Oh wait til’ I do what I do
Hit you with that ddu-du ddu-du du
Aye aye
Hit you with that ddu-du ddu-du du
Aye aye
Ddu-du ddu-du du

Lisa has finally chosen a dress she would wear to her upcoming concert. But she always takes opinion of her crew members first thing. They are at a shopping mall, scattered, each choosing their own costumes. Lisa wants to show her chosen dress to her crew members: Jennie, Jisoo and Rose.

The shopping mall can be modeled as a grid. Lisa is at (Lx, Ly), Jennie is at (Jx, Jy), Jisoo at (Sx, Sy) and Rose at (Rx, Ry).

Lisa wants to show her dress to everyone and come back to her initial location. But being the laziest she is, she wants to travel the minimum distance to show them all and return.

The distance between two points are their Manhattan Distance. That is, the distance between (x, y) and (p, q), d = | p-x | + | q-y |.

Input

Input consists of 4 lines, each line having two integers representing a co-ordinate.

First line gives out the location of Lisa: Lx Ly
Second line Jennie: Jx Jy
Third line Jisoo: Sx Sy
Fourth line Rose: Rx Ry

-109 <= Lx, Ly, Jx, Jy, Sx, Sy, Rx, Ry <= 109

It is guaranteed that no two co-ordinates are same.

Output

Output a single integer, denoting the minimum distance Lisa needs to travel in order to show her friends the dress she chose and come back to her initial location.

Sample

InputOutput
1 3
2 5
7 9
6 2
26


Submit

Login to submit.

Statistics

54% Solution Ratio
dip_BRUREarliest, May '19
dip_BRURFastest, 0.0s
dip_BRURLightest, 131 kB
hamza05Shortest, 557B
Toph uses cookies. By continuing you agree to our Cookie Policy.