Kattis

# Vacuumba

You are developing software for a new generation of robotic floor vacuums. Being an inexpensive, mass market robot, this device has a fairly simple way of navigating around the room. It can turn by some angle to the left or right and then move forward in a straight line. A plan for the robot consists of a sequence of these straight-line segments. The robot starts at the origin, facing in the positive $Y$ direction. Your job is to try to predict where the robot will be after following a plan.

## Input

Input consists of several test cases. The first line contains an integer $1 \leq n \leq 25$ telling how many. Each of the following test cases begins with an integer, $1 \leq m \leq 10$, giving the number of segments in the robot’s plan. This is followed by $m$ lines, each describing a segment in the plan. Each segment is described by a pair of real numbers, a rotation angle in degrees followed by a distance. The angle is in the range $[-360,360]$ and the distance is in the range $[-100,100]$. The rotation angle tells how much the robot should turn before moving forward the given distance. A positive rotation angle indicates a counter-clockwise turn. A negative angle indicates a clockwise turn. All real numbers have at most $8$ digits past the decimal.

## Output

For each test case, print out the expected $X \; Y$ location of the robot after following the path. Your answer should be accurate to within $10^{-3}$ for each coordinate.

Sample Input 1 Sample Output 1
2
2
0 10.5
90 5
1
-45 10

-5.000000 10.500000
7.071068 7.071068
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.5089837312698364, "perplexity": 395.86833100813226}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2017-43/segments/1508187822992.27/warc/CC-MAIN-20171018142658-20171018162658-00319.warc.gz"}