Conveyor
Time limit2sMemory limit1024 MB
Given a sequence of -1, 0, and 1 values, decide whether their sum is negative, positive, or zero, and print Left, Right, or Stay.
- Level
Easy1 of 10
- Topics
- Implementation
- Solved
- No attempts yet
Statement
Today Dipper found a mysterious conveyor in the forest. His diary had a page with some information about this object. For example, he noticed a sequence of numbers, each of which is , , or .
Next to the conveyor he found a control panel with three buttons, labeled with the same numbers. He had already checked what happens when each button is pressed. Pressing -1 shifts the conveyor one inch to the left, pressing 1 shifts it one inch to the right, and pressing 0 causes no visible change (although who knows, maybe a portal to a parallel world opens somewhere at that moment).
Dipper was ready to press the sequence of numbers from the diary, but first he wanted to be careful and find out at least in which direction the conveyor will end up moving from its current position.
Help him.
Input
The first line contains one integer , the number of values in the sequence ().
The second line contains numbers, each of which is , , or . This is the sequence from the diary.
Output
Print Left if the conveyor ends up shifted to the left, Right if it ends up shifted to the right, and Stay if it returns to its original position.