Perform Bitwise Shifts

You are given an integer n (in base-10) and a string left or right indicating the direction of the bitwise shift. You are also given an integer k indicating the number of positions by which n 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 n (0 ≤ n ≤ ).
The second line contains a string, either left or right, indicating the direction of the bitwise shift.
The third line contains a single integer k (0 ≤ k ≤ 16).

Output

The number n 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