NTH1 - Nobabs Treasure Hunt

All of us love treasures, right? That's why young nobab Ashraf-uddowla searching for a Treasure Island. And one day he find a 2d grid Treasure Island, but here is one problem. The problem is that if any one wants to find the Treasure, at first he/she solve a riddle. The riddle is “To get something, you have to give something”. Nobab Ashraf-uddowla know well that only one person can solve this riddle and he is shah-sufi-Apple-Mahmud. That’s what he think sufi-apple solved this riddle and said that if any one wants to find that Treasure for each move he/she will spend 1 taka. That mean if you are in place (x,y) in the grid you will pay 1 taka for (x,y+1) or (x,y-1) or (x+1,y) or (x-1,y) each move. Thats not enough, sufi-apple also said that only that person can open the treasure who spend least taka for finding Treasure. Now nobab very worried about Treasure and decide that who can help him to find that Treasure will awarded by one AC(accepted).

You have a good chance of being rewarded. So help nobab to finding  Treasure .

Input

First line contains four positive integers (x,y) and (t1,t2) where (x,y) is the position of you in 2d grid and (t1,t2) is the position of Treasure .
note that diagonal moves are not possible .

Constraints

  • -1000000 ≤ (x,y) ≤ 1000000
  • -1000000 ≤ (t1,t2) ≤ 1000000

Output

Print the only integer which is the minimum cost to find Treasure.

Example

Input:
0 0 2 0

Output:
2

Added by:asif
Date:2020-02-28
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All

hide comments
2020-04-02 01:46:00
This should be moved to tutorial.
2020-03-17 22:20:14 Scape
Move to tutorial please

Last edit: 2020-03-17 22:20:24
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.