Experiment Class
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

In an experiment class, teacher assigns a homework to all the students: take water samples of both rivers.
It’s a huge physical work for Komorebi, so he decides to find the shortest way.
Let’s put the question in a two-dimension plain. Assume the converging point of two rivers is and
two rivers are radiations that start from the converging point. Given the point two rivers go
through respectively.
Komorebi needs to know the shortest distance if he starts from the starting point, passes by two

rivers and finally ends at the ending point.

Can you help him?

输入描述:

Only one line contains  integers .
It is guaranteed that  and  will not be  at the same time.

输出描述:

Only one number indicates the shortest distance.
The value should be rounded to three decimal places.
示例1

输入

复制
0 1 1 0 0 0 3 3

输出

复制
4.243