eolymp
bolt
Try our new interface for solving problems
Problems

Path to the parallelepiped

Path to the parallelepiped

Time limit 1 second
Memory limit 64 MiB

On the surface of a cuboid { (x, y, z) | 0xL, 0yW, 0zH } are two points with coordinates (x_1, y_1, z_1) and (x_2, y_2, z_2). There are many ways of passing on the surface of the boxes, and connecting the given points. Required to find the square of the length of the shortest such paths.

Input data

Input file contains (in order) the following 9 integers: L W H 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 L, W, H does not exceed 100.

Output data

Derive the output file a single integer - the squared length of the desired path.

Examples

Input example #1
3 4 4
1 2 4
3 2 1
Output example #1
25