Due to the installation of a new fire alarm in ITMO server room, the system may be occasionally unavailable on the 27-th of May between 06:00 and 15:00 (UTC).
×

time limit per test: 1.25 sec. memory limit per test: 65536 KB

input: standard output: standard

You have given the square NxN on a checkered sheet. Size of each cell is 1x1, (1, 1) is leftmost top corner and (N, N) is rightmost bottom corner. Initially all cells are white. There are M repaintings inside of the square, where one repainting changes color of specified rectangle to some color (white or black). All sides of repainted rectangles are parallel to sides of square. You need to find amount of white cells after all repaintings.

Input

The first line of input consists of two numbers N and M (1<=N<=1000, 1<=M<=5000). Each of the next M lines consists of X1 Y1 X2 Y2 C, where (X1, Y1) and (X2, Y2) are indexes of opposite corners of the rectangular, and C is a symbol 'b' or 'w' ('b' means black color and 'w' - white) (1<=X1,X2,Y1,Y2<=N). All numbers in input are integer.

Output

Write amount of white cells after all repaintings.

Sample test(s)

Input

9 6 2 2 4 6 b 4 3 3 3 w 6 2 8 6 b 5 3 6 9 w 8 3 9 9 w 1 5 3 5 w