#C8342. Robot Final Position

    ID: 52314 Type: Default 1000ms 256MiB

Robot Final Position

Robot Final Position

A robot starts at the origin \( (0,0) \) and executes a sequence of commands. Each command is either:

  • Move x y: Moves the robot to the position \( (x,y) \).
  • Return: Resets the robot's position to the origin \( (0,0) \).

You are given an integer \( n \) on the first line representing the number of commands, followed by \( n \) lines with one command per line. Your task is to simulate the commands in the given order and output the final position of the robot as two space-separated integers.

inputFormat

The input is read from standard input (stdin) and has the following format:

n
command_1
command_2
... 
command_n

Where the first line is an integer \( n \) representing the number of commands, and each subsequent line is either a "Move x y" command or a "Return" command.

outputFormat

The output should be written to standard output (stdout) and display the final coordinates of the robot in the format:

x y

where \( x \) and \( y \) are the final coordinates after processing all commands.

## sample
5
Move 1 2
Move 3 4
Return
Move -1 -1
Move 5 5
5 5