Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/case-nuqtani-burish

Rotate a point

Easy 1000 ms 64 MB 24%
Share

A point $(x; y)$ of the coordinate plane is rotated counterclockwise around the origin by $\alpha$ degrees. Find the coordinates of the point after the rotation.

A point rotated around the origin by right angles

Input

One line with three integers: $x$, $y$ and $\alpha$.

Output

One line with two integers: the $x$ and $y$ coordinates of the new point.

Note

$-1000 \le x, y \le 1000$
$\alpha \in \{0, 90, 180, 270\}$

Examples

Input #1
3 1 90
Output #1
-1 3
Input #2
3 1 270
Output #2
1 -3

Sign in to submit a solution

Signing up is free and takes a minute.