308. Hyperboloid Distance

Time limit per test: 0.5 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard

You are given two points A and B on the surface of the hyperboloid x2+y2-z2=1. Find the shortest distance between them along the surface.

The input file contains six real numbers: xA, yA, zA, xB, yB and zB (coordinates of A and B), separated by spaces and/or line breaks (-1 ≤ zA, zB ≤ 1).

Output the shortest distance between A and B along the surface of the hyperboloid. Your answer should be accurate within +-0.1.

sample input
sample output
1 0 0
0 1 0

Online Contester Team © 2002 - 2010. All rights reserved.