ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

USU Junior Contest, October 2006

About     Problems     Submit solution     Judge status     Standings
Contest is over

A. Points on a Parallelepiped

Time limit: 1.0 second
Memory limit: 64 MB
Petya wants to make a paper parallelepiped with dimensions A × B × C. He has already produced a surface map of the parallelepiped (see figure):
Problem illustration
On this surface map Petya has marked two points with coordinates (x1y1) and (x2y2). Can you find the distance between these points after the parallelepiped is assembled?

Input

The first line contains integers ABC (1 ≤ ABC ≤ 1000). In the second line there are the coordinates of the first point (x1y1), and in the third line there are the coordinates of the second point (x2y2). The numbers x1, x2, y1, y2 are given with two fractional digits. The points (x1y1) and (x2y2) are different and belong to the surface map.

Output

Output the distance between the marked points after the parallelepiped is assembled, with accuracy to 10−6.

Sample

inputoutput
2 2 2
3.00 3.00
5.00 5.00
1.4142135623730950
Problem Author: Vladislav Isenbaev, Alexander Toropov
Problem Source: XIII-th USU Junior Contest, October 2006
To submit the solution for this problem go to the Problem set: 1489. Points on a Parallelepiped