Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

EIUDAILYSALE - The total sales by day

You are given a list of transactions, each of them includes date, product code, quantity and selling price.

Your task is to write a program to print total quantity and total revenue by day from minimum date to maximum date (Note: print all days from minimum date to maximum date).

 

For any date that has no transaction, print date, total quantity as 0 and total revenue as 0.

Input

  • The first line contains one integer N - the number of transactions (1 ≤ N ≤ 105).
  • Each line in the next N lines contains 4 integers representing a transaction. All of these do not exceed 109, the difference between the maximum date and the minimum date is not more than 105.
  • Dates are in ascending order.

Output

For each day, output the date, total quantity, and total revenue by that day. Dates are listed in ascending order.

Sample

Input

Output

8

10 1 20 100

12 2 10 150

12 3 15 100

14 1 15 200

14 2 30 110

15 1 25 90

15 3 25 120

15 1 10 100

 

10 20 2000

11 0 0

12 25 3000

13 0 0

14 45 6300

15 60 6250


Added by:Ha Minh Ngoc
Date:2023-06-14
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.