Perform Bitwise Shifts

You are given an integer (in base-10) and a string "left" or "right" indicating the direction of the bitwise shift. You are also given an integer indicating the number of positions by which should be shifted.
πŸ’‘
For example, if we left shift the integer 3 (11 in binary) by 1 position, it becomes 110, which is 6 in base-10.
Similarly, if we right shift the integer 4 (100 in binary) by 2 positions, it becomes 1, which is 1 in base-10.
Write a program that prints the result after performing the bitwise shift operation.

Input

The first line contains a single integer ().
The second line contains a string, either "left" or "right," indicating the direction of the bitwise shift.
The third line contains a single integer ().

Output

The number after performing the bitwise shift operation.

Examples

Input
Output
3 left 2
12
5 right 1
2

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue