Abeer got a robot as a gift. The robot can move and is programmable. The list of commands that the robot can understand are as follows.
Command 1: Go right
Command 2: Go up
Command 3: Go left
Command 4: Go down
Once any command is issued, the robot moves one unit in the direction specified by the command. A program for the robot to move is constructed by giving a sequence of commands that are listed above. Here is an example program:
1 1 2 3 4 2
In this program the robot executes Go right - Go right - Go up - Go left - Go down - Go up, and at the end of the program the robot will be 1 unit to the right and 1 unit up from the starting point.
Abeer puts the robot in its starting position and then runs the following program.
2 2 2 4 1 4 3 2 2 1 1 4 4 4 4 3 2 1 1 3 2 4 4 3 1 1 1 2 4 3 2 4 2 2 1 1 3 4 1 3 2 2 3 3 2 4 4 2 2 3 3 4 2 1 1 2 3 4 3 4 3 1 2 4 4 1 3 3 4 3 4 2 1 3 1 4 1 2 1 2 1 3 4 2 4 2 3 2 1 3 3 3 2 1 4 1 1 3 4 1 1 2 3 4 3 1 4 3 4 1 2 2 4 1 3 1 1 1 4 2 2 1 2 2 4 1 1 1 4 4 4 3 2 4 1 4 1 1 3 3 3 1 3 1 2 2 4 1 2 4 1 4 3 2 4 1 1 1 4 3 1 3 3 4 2 3 4 4 1 4 4 4 2 1 4 2 3 2 4 3 1 1 3 1 4 4 4 4 1 1 4 4 2 1 3 4 3 4 3 3 3 4 1 3 4 1 2 3 3 2 2 3 1 1 2 4 1 2 4 2 4 4 4 4 1 4 3 2 2 1 4 4 3 2 1 1 1 1 1 3 2 2 2 3 4 1 3 1 4 4 3 1 4 2 3 3 1 1 3 1 3 1 1 2 3 3 1 4 1 1 4 4 1 1 4 3 2 1 1 4 1 2 2 3 2 3 4 2 3 2 1 4 3 1 1 1 2 1 1 1 1 4 1 3 4 3 4 3 2 1 1 4 1 3 4 2 3 2 1 1 3 3 1 3 1 1 2 4 1 3 2 2 1 4 4 2 1 4 4 3 3 1 1 3 2 1 4 4 2 3 3 4 4 4 3 2 3 2 3 4 2 4 3 3 4 3 4 1 4 2 1 4 3 2 2 2 3 3 2 4 2 2 3 3 1 2 3 1 2 2 3 4 2 1 2 3 3 2 4 4 1 3 1 4 3 3 2 2 3 1 4 1 1 3 3 4 2 4 2 2 1 3 4 3 4 2 3 2 1 3 3 1 4 3 3 3 2 3 1 3 4 1 3 2 2 3 4 3 2 2 2 3 4 2 3 3 4 3 1 1 1 4 1 1 2 4 1 3 4 4 2 3 4 4 2 4 1 3 1 1 2 4 4 4 1 4 1 2 4 1 4 4 2 4 2 1 4 2 4 3
You have two questions to answer.
Subproblem 0
How many units to the right will the robot be from the starting point? Note that the answer should be negative if the robot is to the left of where it started from.
Answer

Save Saved answer
Subproblem 1
How many units to the up will the robot be from the starting point? Note that the answer should be negative if the robot is to the bottom of where it started from.
Answer

Save