To show their spirit for the holidays, the cows would like to paint a picture! Their picture will be represented as an R x C (1 \leq R \leq 50,000; 1 \leq C \leq 15) grid of unit squares, each of which is either 0 or 1. The grid rows are conveniently numbered 1..R; the columns are numbered 1..C.
Being pressed for time, the cows have asked their neighbors north of the border for help. Under the very helpful supervision of Canmuu the moose, they constructed a machine to throw paint at the picture in entire buckets! Beginning with all 0's in the picture grid, the machine splashes a certain paint color (either 0 or 1) over a rectangle in the grid. In particular, Canmuu suggested that they perform Q (1 \leq Q \leq 10,000) operations; operation i consists of five integers

, and

(

), meaning that the cows will paint each unit square with a row index between

and

, inclusive, and a column index between

and

, inclusive, with color

.
However, painting a picture like this is quite prone to mistakes. So Canmuu has enlisted you to determine, after each operation, the number of unit squares in the grid which are the correct color.