        implicit real*8(a-h, o-z)
        dimension ngaku(100),nsaiten(100),
     &  sinki(100,20),sinrai(100,20),happyou(100,20),situmon(100,20)
        character(10) saiten(100,20)
!
        read*, ninzuu
        do i=1,ninzuu
         read*, ngaku(i)
         read*, nsaiten(i)
         do j=1,nsaiten(i)
         read*,saiten(i,j),
     &   sinki(i,j),sinrai(i,j),happyou(i,j),situmon(i,j)
         end do
        end do
!
!
!
        do i=1,ninzuu
          gsinki=0.; gsinrai=0.; ghappyou=0.; gsitumon=0.
         do j=1,nsaiten(i)
          gsinki=gsinki+sinki(i,j)
          gsinrai=gsinrai+sinrai(i,j)
          ghappyou=ghappyou+happyou(i,j)
          gsitumon=gsitumon+situmon(i,j)
         end do
         print*, ngaku(i), ',' , saiten(i,j), ',' ,
     &   gsinki/nsaiten(i), ',' ,
     &   gsinrai/nsaiten(i), ',' ,
     &   ghappyou/nsaiten(i), ',' ,
     &   gsitumon/nsaiten(i) 
        end do
        end
