B. What to solve next?
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

After the guys submitted their first task, the question arose — which task should be solved next?

Begimai, who had experience in such competitions, suggested looking at the page with the "Results".

This page shows how many tasks each team has solved — and how many attempts the team made on each task:

  • If a team solved a task, it is indicated in the table with a +, followed by the number of incorrect attempts before the first successful one.
  • If a team did not solve a task, it is indicated in the table with a -, followed by the number of incorrect attempts already made.
  • If a team did not make any attempts on a task, nothing is indicated in the table for that task.

Begimai explained that additional information about the difficulty of tasks can be extracted from this statistics:

  • If a task is hardly solved, except by the teams at the very top of the table — then, most likely, it is more difficult for beginners compared to other tasks.
  • If different teams make many incorrect attempts on the same task — then, most likely, there are some "underwater stones" and tricky cases that are not obvious at first glance.

The guys decided to collect a small statistics for each task:

  • the number of teams that solved the task;
  • the number of teams that made at least one attempt on the task;
  • the total number of incorrect attempts made by teams on the task.
Input

The first line contains two integers $$$n$$$ and $$$p$$$ $$$(1 \le n, p \le 100)$$$ — the number of teams and the number of tasks in the results table.

The $$$i$$$-th of the following $$$n$$$ lines contains information about the results of the $$$i$$$-th team — $$$p$$$ pairs of values $$$R_{i, j}$$$, separated by spaces:

  • If the $$$i$$$-th team did not make attempts on task $$$j$$$, then $$$R_{i, j}$$$ will consist of - and the number $$$0$$$.
  • If the $$$i$$$-th team made $$$k$$$ incorrect attempts on task $$$j$$$, but did not solve it, then $$$R_{i, j}$$$ will consist of - and the number $$$k$$$ $$$(1 \le k \le 100)$$$.
  • If the $$$i$$$-th team made $$$k$$$ incorrect attempts on task $$$j$$$, but then solved it, then $$$R_{i, j}$$$ will consist of + and the number $$$k$$$ $$$(0 \le k \le 100)$$$.
Output

In the $$$j$$$-th of the $$$p$$$ lines, output three integers $$$S_j$$$, $$$T_j$$$, $$$F_j$$$ separated by spaces:

  • $$$S_j$$$ $$$(0 \le S_j \le n)$$$ — the number of teams that solved task $$$j$$$;
  • $$$T_j$$$ $$$(S_j \le T_j \le n)$$$ — the number of teams that made at least one attempt on task $$$j$$$;
  • $$$F_j$$$ $$$(0 \le F_j \le 10^9)$$$ — the total number of incorrect attempts on task $$$j$$$.
Example
Input
2 3
+ 0 + 3 - 5
+ 1 - 0 - 12
Output
2 2 1 
1 1 3 
0 2 17 
Note

First test example

In the results table, there are $$$2$$$ teams and $$$3$$$ tasks:

  • The first team corresponds to the first line:
    • The first pair is + and $$$0$$$ — the first task was solved by the team without incorrect attempts.
    • The second pair is + and $$$3$$$ — the second task was solved by the team after $$$3$$$ incorrect attempts.
    • The third pair is - and $$$5$$$ — the team has already made $$$5$$$ incorrect attempts, but has not yet solved the third task.
  • The second team corresponds to the second line:
    • The first pair is + and $$$1$$$ — the first task was solved by the team after one incorrect attempt.
    • The second pair is - and $$$0$$$ — the team did not make attempts on the second task.
    • The third pair is - and $$$12$$$ — the team has already made $$$12$$$ incorrect attempts, but has not yet solved the third task.

In total, it turns out that

  • The first task was solved by $$$2$$$ teams, $$$2$$$ teams also made attempts on it, and the total number of incorrect attempts is $$$1$$$.
  • The second task was solved by $$$1$$$ team, $$$1$$$ team also made attempts on it, and the total number of incorrect attempts is $$$3$$$.
  • The third task was solved by $$$0$$$ teams, $$$2$$$ teams made attempts on it, and the total number of incorrect attempts is $$$17$$$.