program answer
  implicit none

  integer(8) :: N, M, i, ans, ba
  integer(8), allocatable :: p(:), T(:), un(:)
  character(2), allocatable :: S(:)
  read(*,*) N, M
  allocate(p(M))
  allocate(S(M))
  allocate(T(N))
  allocate(un(N))
  do i = 1, M
     read(*,*) p(i), S(i)
  end do

  T=0
  un=0
  ans=0
  ba=0
  do i = 1, M
     if(T(p(i))==0.and.S(i)=='WA') then
         un(p(i))=un(p(i))+1 
     else if(T(p(i))==0.and.S(i)=='AC') then
           ba=ba+un(p(i))
           T(p(i))=1
           ans=ans+1
     end if
  end do

  write(*,*) ans, ba

  deallocate(p, T, un, S)
  
  stop
 end program answer
