P15317 [VKOSHP 2025] Two Skew Roads

Description

While reading the statements of yet another boring problem in some contest (unrated, teams preferred) that some people called incredibly important, you fell into nostalgia and thoughts about your hometown, Berlodar. You remembered how you enjoyed walking along its two main roads --- Holmes Avenue and Watson Street, which divide the city into four huge districts. You smirked slightly when you recalled how after some long-ago lesson in fifth grade, when your math teacher told you about angles and distances, your eyes lit up, and for the entire evening that followed, you walked back and forth around the city's main intersection and found out that the width of Holmes Avenue is $\ell_H$ meters, the width of Watson Street is $\ell_W$ meters, and they intersect at an angle of $\alpha$ degrees. You dug up a map of the city at home and were pleased to confirm that your measurements were correct. Soon you will return to Berlodar for the New Year holidays and want to visit your four friends. They all live in different districts, so you will have to cross a main road many times, and sometimes both, to visit all your friends. While planning your walk, you will wonder: what distances will you have to cover between these four districts? The traffic light regime on these two streets implies that the green light for all pedestrians (and, consequently, the red light for vehicles on both roads) turns on simultaneously, so to get between any pair of districts (even those located opposite each other), you will walk along the shortest segment connecting their boundaries. There are $\frac{4 \cdot (4 - 1)}{2} = 6$ pairs of districts. Write a program that prints six numbers equal to the pairwise distances between the districts in Berlodar.

Input Format

The input consists of a single line containing three real numbers $\ell_H$, $\ell_W$, and $\alpha$, denoting the width of Holmes Avenue in meters, the width of Watson Street in meters, and the angle at which they intersect in degrees ($0.01 \le \ell_H, \ell_W \le 1000$; $0.1 \le \alpha \le 90$). Each of these three numbers will be provided with a precision of up to three decimal places.

Output Format

Print six real numbers in any order --- the pairwise distances between the four districts of Berlodar in meters. Your answer will be accepted if the relative or absolute error does not exceed $10^{-6}$. Formally, if $\left\{a_i\right\}_{i \in [1..6]}$ is your answer and $\left\{b_i\right\}_{i \in [1..6]}$ is the jury's answer, it will be accepted if the numbers in array $a$ can be rearranged such that after rearrangement, the condition $\frac{|a_i - b_i|}{\max\{b_i, 1\}} \le 10^{-6}$ holds for each index $i \in [1..6]$.

Explanation/Hint

:::align{center} ![](https://cdn.luogu.com.cn/upload/image_hosting/n1a9hyjj.png) :::