Limits 1s, 512 MB

Lionel Messi, the celebrated hero of the Argentinian national football team, experienced the thrill of the FIFA World Cup Qatar 2022. His exceptional football skills brought Argentina closer to glory and ignited national pride.

During a post-World Cup celebration, Messi stumbled upon a prestigious sports lounge hosting an archery competition. Intrigued by the precision and challenge of archery, he decided to test his skills on the grand stage of this esteemed establishment. To the amazement of onlookers and media, Messi's natural talent for hand-eye coordination and competitive spirit translated seamlessly to the archery target board, leaving a lasting impression.

Archery is a sport that involves shooting arrows at a target board. However, this version of archery differs from the standard form.

In this particular version, the archery target board is divided into four circles, each with its own unique color and score. Additionally, each player is allowed to shoot only once. Consequently, when a player shoots an arrow and it lands in a specific circle among the four, they will receive scores based on that circle.

So, Lionel Messi will shoot an arrow at the archery board, specifically at coordinates (X,Y)(X, Y). It is guaranteed that the arrow will always hit the board. If the arrow is shot on the line of circumference of any circle then the score will be considered for that particular circle.

The radius of the four circles Yellowr,Redr,Bluer,BlackrYellow_r, Red_r, Blue_r, Black_r and the center coordinate (Cx,Cy)(C_x, C_y) for all circles are given.

Now, calculate the score Lionel Messi will receive from this shot.

Input

The first line of the test case consists of four space-separated integers X,Y,CxX, Y, C_x and CyC_y — indicating Lionel Messi's arrow position (X,Y)(X, Y) and the center coordinates (Cx,Cy)(C_x, C_y) of the four circles.

The second line of the input consists of four space-separated float values Yellowr,Redr,Bluer,BlackrYellow_r, Red_r, Blue_r, Black_r — indicating the radius of the four circles.

103X,Y103-10^3 \le X,Y \le 10^3

103Cx,Cy103-10^3 \le C_x, C_y \le 10^3

0<Yellowr<Redr<Bluer<Blackr3×1030 < Yellow_r < Red_r < Blue_r < Black_r \le 3 \times 10^3

Output

Output a single integer value — the score Lionel Messi gets after the arrow shoots to the board.

Samples

InputOutput
0 7 0 0
7.00 14.00 21.00 28.00
100
InputOutput
2 13 0 0
4.50 9.00 13.50 18.00
50

Formula of Distance Between Two coordinate is, (x2x1)2+(y2y1)2\sqrt{ (x_2 - x_1)^2 + (y_2 - y_1)^2 }

Submit

Login to submit.

Statistics

96% Solution Ratio
tanvir4nEarliest, 9M ago
user.2827Fastest, 0.0s
the.shoaib2Lightest, 4.9 MB
Marzuq01Shortest, 371B
Toph uses cookies. By continuing you agree to our Cookie Policy.