n, m = raw_input().split() p = [] for i in xrange(int(n)): tokens = raw_input().split() p.append( (tokens[0], sum(int(scr) for scr in tokens[1:])/float(m)) ) print '%.2f' % ( reduce(lambda x,y: x+y[1], p, 0)/float(n) ) for student in p: print '%s %.2f' % (student[0], student[1])