题目描述
So, you are bored and you think about playing a game. The game is like, if you win your money will be
doubled and eleven dollars extra will be added to it. If you lose, your money will be halved (if the
amount is odd, it will be halved to the upper integer). The inital amount of money you have is 'X'. A
sequence of W and L are given as input, and 'X' is given initially. You have to find the amount of money
remaining with you at the end of the game.
Input
The first line contains a single integer X denoting the amount of money you initially have.
The second line contains a sequence of characters of W and L representing Win and Loss respsectively.
Output
output a single line containing the amount you have at the end of the game.
Constraints
Length of sequence ≤ 1000
Example
Input #1:
51
L
Output #1:
26
Input #2:
23
LWLW
Output #2:
47
Explanation
Example case 1. The game is a loss. So, the amount of money is to be halved.
输入格式
见题面
输出格式
见题面