URI Online Judge | 2231

Lunar Temperature

OBI - Olimpíada Brasileira de Informática 2002 BR Brazil

Timelimit: 1

Without the protection of the atmosphere and the magnetic belt that exist on Earth, the moon is exposed to attack from the Sun, which is a star ever atomic explosion. The explosions from the Sun emit lethal waves of particles. A person to remain unprotected on the surface of the moon, a place where the sun was incident directly, would suffer a radioactive bombardment as intense as it was in the vicinity of the Russian plant of Chernobyl at the time of the accident that killed 31 people in 1986. In addition to solar radiation another effect of this lack of protection from the sun that exists on the Moon is the huge variation in temperature. In the regions near the lunar equator, the temperature variation is brutal, from about 130 degrees above zero during the day to 129 degrees negative at night.

To study more accurately the temperature variations on the surface of the moon, NASA sent to the moon a probe with a sensor that measures the temperature of 1 in 1 minute. An important fact that researchers want to find out is how it behaves the average temperature considered at intervals of a given time (one hour, half hour, eight hours, etc.). For example, for the sequence of measurements 8, 20, 30, 50, 40, 20, -10, and four minutes intervals, respectively the averages are 108/4 = 27 140/4 = 35 140/4 = 35 and 100/4 = 25.

You were recently hired by NASA, and your first task is to write a program, known the sequence of temperatures measured by the sensor, and the size of the desired range, tell which most and which the lowest average temperature observed, considering the size range given away. 


The input consists of several test sets. The first line of a test set contains two positive integers N (0 ≤ N ≤ 10000) and M (1 ≤ MN), which respectively indicate the total number of measurements temperature (-200 ≤ temperature ≤ 200) of a sequence obtained by the sensor, and the size of the interval, in minutes, that the average should be calculated. The N each following lines contain an integer, representing the sequence of sensor measurements. The end of input is indicated when N = M = 0.


For each entry test set your program should produce three lines. The first line identifies the test set, the form "Teste n", where n is numbered from 1. The second line must contain two integers X and Y, separated by at least one blank space, representing respectively the values the lowest and highest average temperature, as determined by your program. The average value should be truncated if the mean is not an integer (that is, only to be printed the integer part). The third line should be left blank. The spelling shown in Example output below should be followed strictly.

Input Sample Output Sample

4 2





7 4








0 0

Teste 1

-8 3

Teste 2

26 75