Problems

# Spider and Fly

# Spider and Fly

In an empty rectangular room in the sizes `A х B х C`

(the length, width, height) has fallen to the floor the fallen asleep fly. The spider who was on one of walls, or on a room’s floor, has started to move to it on the shortest way.

On what distance it thus will move?

## Input data

In the first line it is set the sizes of a room `A`

, `B`

, `C`

. In the second line - co-ordinates of a fly on the floor `X[1]`

, `Y[1]`

, and spider `X[2]`

, `Y[2]`

, `Z[2]`

.

All input date - the integers which are not exceeding 500.

## Output data

One line – the distance on which the spider will move, calculated to within 2 signs after a decimal point.

## Examples

Input example #1

1 1 1 1 1 1 1 0

Output example #1

0.00