Bruno and his friends are playing with water guns. They are avid gamers, so their game is not an ordinary water fight but almost like a real video game. They even invited a moderator to keep track of the gameplay.
At the beginning of the game, the players are divided into two teams — "Pineapple" and "Blueberry".
During the game, the moderator records the moments when one player shoots another. As in video games, successful shots earn points.
If a player from one team hits a player from the opposite team, their team earns points. However, if the same player hits some opponent within the next seconds, that shot is considered a double shot, and the team receives an additional points. A player can make several double shots in a row — for each of them, their team gains another points in addition to the regular .
The first line contains one integer n~(1 \le n \le 100) — the number of shots made during the game.
Each of the next lines contains three integers t_i, a_i, b_i~(0 \le t_i \le 1000,~1 \le a_i, b_i \le 8), meaning that player a_i shot player b_i at time t_i (in seconds).
Players from team "Pineapple" are numbered from to , and players from team "Blueberry" are numbered from to . It is guaranteed that in each shot, players a_i and b_i belong to different teams.
All values of t_i are distinct and given in increasing order.
Print two integers — the total score of team "Pineapple" and the total score of team "Blueberry".
In the first example, at seconds and , player shoots players and from the opposite team.
For each shot, team "Pineapple" earns points, and since the second shot was made within seconds, the team receives an additional points. In total: 250 = 2 \cdot 100 + 50. Team "Blueberry" made only one shot at the opponents and scored points.
In the second example, player made two consecutive double shots, so team "Pineapple" earned a total of 3 \cdot 100 + 2 \cdot 50 = 400 points.
Example 1
Example 2
Example 3