The planet inhabited by rabbits is not much different from ours. It has beautiful nature and is the third planet from the Krilikus Beta Mega Star. The main difference is that the rabbit's planet has the shape of a cube with side . This is a little strange, but the rabbits like it and believe that this shape makes navigation on the planet easier.
You are asked to check how much easier it is to live on a cubic planet. Try to calculate the shortest distance between two points on such a planet.
The only line contains seven integers separated by spaces: R,\ x_1,\ y_1,\ z_1,\ x_2,\ y_2,\ z_2 (1 \leq R \leq 100000, 0 \leq x_1,y_1,z_1,x_2,y_2,z_2 \leq R) — the side of the cube and the coordinates of the points. Two opposite vertices of the planet are at (0, 0, 0) and (R, R, R); all cube sides are parallel to the coordinate axes. It is guaranteed that the points are on the surface.
Output a single number — the distance between the given points along the planet's surface, rounded to the nearest integer.
Example 1