The cute robot WALL-E is collecting trash on planet Earth, which we will represent as a 2D cartesian plane.
Initially, WALL-E is sitting in his base station at coordinate $(0, 0)$, facing north, ie, towards the positive Y-axis. In its routine tasks of locating garbage, WALL-E executes a number of operations of the following types:
- $L$: Turn left 90 degrees
- $R$: Turn right 90 degrees
- $F$ $x$: Advance forward $x$ units of distance in the direction that he's facing
After executing those operations, WALL-E finally finds a piece of garbage and now he must return back to the base station. As his energy level is quite low, WALL-E must return to the base station using the minimum number of operations. In particular, the operation of type "$F$ $x$" counts as a single operation regardless of the distance $x$ that WALL-E travels under such an operation. In addition, the final orientation that WALL-E reaches coordinate $(0, 0)$ does not matter.