Under construction

Still being built. Things may change

Swimming

Time limit1sMemory limit1024 MB

Summary
Given Ostap's start, Skumbriewitz's buoy, and Berlaga's position, find the length of a logarithmic spiral path around Berlaga that keeps a constant angle to the line of sight.
Level

Medium7 of 10

Topics
Math, Geometry
Solved
No attempts yet

Problem

Trying to reach Skumbriewitz, who was floundering around the buoy, Ostap Bender swam on his side, keeping an eye on Berlaga, who was sitting on the shore. Ostap's head was turned by a constant angle for the whole time. For that reason he swam along a curve rather than along a straight line, so the angle between the direction of his swimming and the direction to Berlaga was constant.

Your task is to find the length of Ostap Bender's trajectory.

Input

The input consists of three lines. Each line contains two integers with absolute value not exceeding 10510^5. The first line contains the initial coordinates of Ostap Bender, the second line contains the coordinates of his destination, Skumbriewitz, and the third line contains the coordinates of Berlaga. All given points are pairwise distinct. Berlaga and Skumbriewitz do not move while Ostap is swimming.

Output

Print a single real number: the length of the shortest trajectory from Ostap's initial position to Skumbriewitz's buoy, given that the angle between the tangent to the trajectory and the direction to Berlaga is constant. Your answer must have a relative or absolute error not greater than 10−810^{-8}.

Examples1

  1. Example 1

    Input
    10 0
    -10 0
    0 0
    
    Expected output
    31.4159265359