DMOPC '18 Contest 4 P1 - Dr. Henri and Differential Photometry
View as PDFDr. Henri is looking through his telescope at the MRD Observatory. He is observing a certain star  and wants to find its magnitude (a measure of brightness), 
. The magnitude of a star can be any real number.
Dr. Henri is using a device called a differential photometer to measure magnitude. Although this device is very precise, it cannot directly measure the magnitude of a star; it can only measure the difference in magnitudes between two stars.
Fortunately, Dr. Henri knows the magnitude  of a certain star 
. He decides to find 
 by constructing a sequence of 
 stars beginning with 
 and ending with 
. Then, for each star 
 on the list (except 
), he records the difference 
 between the magnitudes of the stars 
 and 
, for a total of 
 observations. He can then calculate a value for 
 from this sequence.
Dr. Henri knows that he must take multiple measurements in order to ensure accuracy, so he constructs  such sequences. Sequence 
 consists of 
 observations, and the value of 
 calculated from 
 is denoted as 
. Of course, due to natural error in measuring, the 
's calculated from each sequence may not be exactly the same. So Dr. Henri will use the mean of the 
's, 
, as the final 
, which he denotes 
.
Given  sequences of observations, please help Dr. Henri find 
.
Constraints
Input Specification
The first line of input will contain one integer, .
The second line will contain one real number, .
The next  lines will contain one integer 
, followed by 
 space-separated real numbers 
, the observations from the 
-th list.
Output Specification
A single line containing one real number, . Your answer will be judged as correct if it has an absolute error of no more than 
.
Sample Input
3
-1.46
2 4.53 1.20
3 4.77 -1.45 2.35
1 5.69
Sample Output
4.236667
Comments