Robot

아직 제출이 없습니다시간 제한3초메모리 제한512 MB

문제

There is an infinitely large 2-dimensional chessboard, in which every cell has a unique integer coordinate (x,y)(x, y). The starting cell has coordinate (0,0)(0, 0). If we start from this cell, walk xx steps to the right, and then walk yy steps upwards, we will arrive at cell (x,y)(x, y). Note that xx and yy could be negative, which means walking in the opposite direction.

There is a robot that starts from cell (0,0)(0,0) and then executes a sequence of commands c_1c_2c_nc\_1 c\_2 \ldots c\_n, where each c_iL,R,D,Uc\_i \in \\{\mathtt{L}, \mathtt{R}, \mathtt{D}, \mathtt{U}\\}, meaning walking one step in the direction of Left, Right, Down, Up, respectively. For example, if the sequence of commands is LRLD\mathtt{LRLD}, then the cells traveled are (0,0)(1,0)(0,0)(1,0)(1,1)(0, 0) \to (-1, 0) \to (0, 0) \to (-1, 0) \to (-1, -1). We call such sequence the travel history of the robot (in this example, the history contains five elements).

For every cell (x,y)(x, y) in the travel history, if it is the ii-th time the robot visits this cell, then the robot earns a score of f(x,y,i)=i((x+1)xor(y+1))+i.f(x, y, i) = i \cdot \left((|x| + 1) \mathrm{xor} (|y| + 1)\right) + i\text{.} The total score is the sum of the score of every cell in the travel history. In this example, the total score is f(0,0,1)+f(1,0,1)+f(0,0,2)+f(1,0,2)+f(1,1,1)=1+4+2+8+1=16f(0, 0, 1) + f(-1, 0, 1) + f(0, 0, 2) + f(-1, 0, 2) + f(-1, -1, 1) = 1 + 4 + 2 + 8 + 1 = 16.

For every ii from 11 to nn, please answer: if we remove c_ic\_i from the sequence of commands, what is the total score earned by the robot after executing the remaining sequence c_1c_2c_i1c_i+1c_nc\_1 c\_2 \ldots c\_{i - 1} c\_{i + 1} \ldots c\_n?

입력

The first line contains an integer nn (2n31052 \le n \le 3 \cdot 10^{5}).

The second line contains a string c_1c_2c_nc\_1 c\_2 \ldots c\_n of length nn, denoting the sequence of commands.

출력

Output nn lines. The ii-th line must contain the total score if we remove command c_ic\_i.