Recently, a new feature has been added to the main Kyrgyz website for programming competitions — the division of problems into separate volumes.
Volumes are numbered with integers starting from 1. Inside each volume, problems are numbered with integers from 0 to n.
Thus, each problem corresponds to a pair of numbers (v, k) — the volume number and the number within the volume, respectively.
Additionally, within each problem, there is a button labeled "go to next":
At the moment, you are on the page of problem (a, b). You are interested in how many button presses are required to reach problem (c, d)?
The first line contains an integer n (1 ≤ n ≤ 1000) — the maximum possible problem number within a volume.
The second line contains two integers a and b (1 ≤ a ≤ 1000, 0 ≤ b ≤ n) — the number of the problem you are currently on.
The third line contains two integers c and d (1 ≤ c ≤ 1000, 0 ≤ d ≤ n) — the number of the problem you want to reach.
It is guaranteed that it is possible to reach problem (c, d) from problem (a, b):
In a single line, output an integer — the required number of presses of the "go to next" button after which you will reach problem (c, d) from problem (a, b).
12
2 5
2 8
3
8
3 4
4 5
10
14
2 11
4 1
20
First test case
The sequence of presses (2, 5) — (2, 6) — (2, 7) — (2, 8) — a total of 3 presses.
Second test case
The sequence of presses:
A total of 10 presses.
| Name |
|---|


