Spider and Fly
Easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
In an empty rectangular room with dimensions (length, width, height), a sleeping fly has landed on the floor. A spider, positioned on one of the walls or on the floor of the room, begins moving toward the fly along the shortest possible path.
How far will the spider have to travel?
Input
The first line provides the dimensions of the room: , , and . The second line gives the coordinates of the fly on the floor, and , and the coordinates of the spider, , , .
All input values are integers no greater than 500.
Output
Output a single number representing the distance the spider will travel, accurate to two decimal places.
Examples
Input #2
Answer #2
Submissions 13K
Acceptance rate 16%