There is an infinitely large 2-dimensional chessboard, in which every cell has a unique integer coordinate (x,y). The starting cell has coordinate (0,0). If we start from this cell, walk x steps to the right, and then walk y steps upwards, we will arrive at cell (x,y). Note that x and y could be negative, which means walking in the opposite direction.
There is a robot that starts from cell (0,0) and then executes a sequence of commands c_1c_2…c_n, where each c_i∈L,R,D,U, meaning walking one step in the direction of Left, Right, Down, Up, respectively. For example, if the sequence of commands is LRLD, then the cells traveled are (0,0)→(−1,0)→(0,0)→(−1,0)→(−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) in the travel history, if it is the i-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. 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=16.
For every i from 1 to n, please answer: if we remove c_i from the sequence of commands, what is the total score earned by the robot after executing the remaining sequence c_1c_2…c_i−1c_i+1…c_n?
The first line contains an integer n (2≤n≤3⋅105).
The second line contains a string c_1c_2…c_n of length n, denoting the sequence of commands.
Output n lines. The i-th line must contain the total score if we remove command c_i.