Compute my GPA

No attempts yetTime limit1sMemory limit256 MB

Problem

Geunwoo spends all his time playing and suddenly wants to know his grade average. He finds logging in to the academic system too much trouble, so compute the credit total and the GPA of each semester for him.

The credit total of a semester is the sum of the credits CC of every course taken that semester. The GPA is the sum of CC times the grade GG over all courses, divided by the credit total.

GPA=i=1NCi×Gii=1NCi\text{GPA} = \frac{\sum_{i=1}^{N} C_i \times G_i}{\sum_{i=1}^{N} C_i}

Input

The first line contains the number of semesters TT. TT is an integer of at least 11.

The information for the TT semesters follows. Each semester starts with a line holding the number of courses NN taken that semester, then NN lines follow, each holding the credit CC and the grade GG of one course, separated by a space. (1N101 \le N \le 10, 1C61 \le C \le 6, CC is an integer)

GG is one of 00, 0.70.7, 11, 1.31.3, 1.71.7, 22, 2.32.3, 2.72.7, 33, 3.33.3, 3.73.7, 44, 4.34.3, and its fractional part is given to at most one digit. A grade whose fractional part is 00 can appear as an integer such as 44 or in decimal form such as 4.04.0.

Output

For each semester, print the credit total and the GPA on one line, separated by a space.

Print the credit total as an integer. Print the GPA rounded to one decimal place, rounding up when the second decimal digit is exactly 55. Always print one digit after the decimal point, so an exact integer GPA prints as 0.00.0 or 4.34.3.