Kingdom Rush 5: Alliance
题号:NC295139
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
Special Judge, 64bit IO Format: %lld

题目描述

Colin is a huge fan of the Kingdom Rush franchise tower defense games. Last year, KR released the latest generation of Kingdom Rush: Kingdom Rush 5: Alliance. As a formidable evil arises in the new generation, an unexpected alliance is taking shape! It will take the finest warriors of Linirea and the relentless Dark Army together to stop it. Therefore, the most attractive feature of the latest generation of games is that you can use two heroes simultaneously!

To measure the power of the double-hero feature, Colin would like to do some simple experiments: Assume that a hero's attack range is a circle on the 2D plane with its coordinates as the center. The path of enemies is a segment on the 2D plane. Colin would like to ask you how long is the total length of the enemy's path that is covered by at least one hero's attack range?

输入描述:

The first line contains three integers x_1,y_1,r_1\ (|x_1|,|y_1|\le 10^9, 1\le r_1\le 10^9), representing the coordinate of the first hero is (x_1,y_1), and the radius of its attack range is r_1.

The second line contains three integers x_2,y_2,r_2\ (|x_2|,|y_2|\le 10^9, 1\le r_2\le 10^9), representing the coordinate of the second hero is (x_2,y_2), and the radius of its attack range is r_2.

The third line contains four integers a,b,c,d~(|a|,|b|,|c|,|d|\le 10^9), representing the path of enemies is a segment from (a,b) to (c,d).

输出描述:

A single line with a number, representing the total length of the enemy's path that is covered by at least one hero's attack range.

Your output will be considered correct if the absolute error to the jury does not exceed 10^{-6}.
示例1

输入

复制
0 0 1
1 1 1
0 0 1 1

输出

复制
1.4142135624
示例2

输入

复制
0 0 1
2 2 1
-1 -1 3 3

输出

复制
4.0000000000