summ = 0
count = 0
while 1:
a = int(input())
if a == 0:
break
elif len(str(abs(a))) == 3 and a % 2 == 0 and a % 3 == 0:
summ += a
count +=1
print(summ/count)
summ = 0
count = 0
while 1:
a = int(input())
if a == 0:
break
elif len(str(abs(a))) == 3 and a % 2 == 0 and a % 3 == 0:
summ += a
count +=1
print(summ/count)