Adjustment Office
Garrison and Anderson are working in a company named “Adjustment Office”. In competing companies workers change the reality, in this company they try to predict the future.
They are given a big square board . Initially in each cell of this board the value of is written. They know that in the future there will be two types of queries on the board:
"" — sum up all values in row , print the result and set all values in row to zero;
"" — sum up all values in column , print the result and set all values in column to zero.
They have predicted what queries and results there will be. They need to ensure that they have correctly predicted the results. Help them by computing the results of the queries.
Input
The first line contains two integers and — the size of the square and the number of queries.
Each of the next lines contains the description of the query. Each query is either or .
Output
Print lines. The -th line shall contain one integer — the result of the -th query.