Farmer John's milk factory can be described by an $N$ by $N$ ($1 \le N \le 1000$) grid of cells that contain conveyor belts. Position ($a,b$) describes the cell that is in the $a$-th row from the top and $b$-th column from the left. There are $5$ types of cells:
Note that conveyor belts can also move items outside the grid. A cell $c$ is unusable if an item placed at cell $c$ will never exit the conveyor belt grid (i.e. it will move around in the grid forever).
Initially, Farmer John has not started building the factory so all cells start out as "?". For the next $Q$ ($1 \le Q \le 2 \cdot 10^5$) days starting from day $1$ and ending at day $Q$, Farmer John will choose a cell that does not have a conveyor belt and build a conveyor belt at the cell.
Specifically, during the $i$-th day, Farmer John will build a conveyor belt of type $t_i$ ($t_i \in {\text{{L,R,U,D}}}$) at position ($r_i,c_i$) ($1 \le r_i,c_i \le N$). It is guaranteed that there is no conveyor belt at position ($r_i,c_i$).
After each day, help Farmer John find the minimum number of unusable cells he can achieve by optimally building conveyor belts on all remaining cells without a conveyor belt.
The first line contains $N$ and $Q$.
The $i$-th of the next $Q$ lines contains $r_i$, $c_i$, and $t_i$ in that order.
$Q$ lines, the $i$-th of which describing the minimum number of unusable cells if Farmer John fills optimally builds conveyor belts on all remaining cells that do not currently have a conveyor belt.