For a grid with each cell colored either white or black, let us define the beauty of the grid as follows:
Consider performing the following operation any number of times:
Choose a path from the upper-left corner to the lower-right corner, consisting only of downward and rightward moves. Invert the colors of all cells on the chosen path.
The beauty of the grid is defined as the maximum possible number of cells colored black.
You have a grid with rows and columns. Initially, all cells are colored white.
You need to process queries in order. The -th query is given in the following format:
You are given two integers and .
If , invert the colors of all cells in the -th row from the top.
If , invert the colors of all cells in the -th column from the left.
Then, find the beauty of the current grid.
输入格式
The input is given in the following format:
()
()
()
All input values are integers.
输出格式
Output lines. On the -th line (), output the answer for the -th query.