Parabola Dancing

One of the most beautiful parks in Meashara contains a place that birds
like very much. It is a nice tree, with two fountains to the left and to
the right from it. Birds like to sit on the tree, and to fly into the
stream of water from the fountains.

A bird is sitting on the tree, and wants to move to another spot on the
tree, using as short path as possible. Calculate this shortest path.

[image]

Input

Input consists of several test cases (at most 20).

Each test case contains four numbers X₁, Y₁, X₂, Y₂. We have
100 ≤ X₁, X₂ ≤ 200, 0 ≤ Y₁, Y₂ ≤ 100. The left fountain produces a
parabola-shaped stream, which goes through points (100,0), (50,100) and
(0,0). Similarly, the right stream goes through (200,0), (250,100) and
(300,0).

The input ends with 0 0 0 0.

Output

Output the length of the shortest path.

Problem information

Author: Eryk Kopczynski

Generation: 2026-01-25T13:23:43.916Z

© Jutge.org, 2006–2026.
https://jutge.org
