Path on the parallelepiped#1036

Path on the parallelepiped

1 second
64 megabytes
Hard

On the surface of a rectangular parallelepiped \{ (x, y, z) \mid 0 \leq x \leq L,\ 0 \leq y \leq W,\ 0 \leq z \leq H \}, two points with coordinates (x_1, y_1, z_1) and (x_2, y_2, z_2) are given. There are many possible paths lying on the surface of the parallelepiped and connecting the given points. Find the square of the length of the shortest such path.

Input

The input contains the following integers: , , , x_1, y_1, z_1, x_2, y_2, z_2.

The numbers are separated by spaces and/or newlines. Each of the numbers , , does not exceed .

Output

Output a single integer — the square of the length of the desired path.

Examples

Example 1

Loading
Loading