program welcome_to_atcoder
  implicit none
  integer :: n, m, p, wa(100000) = 0, i, a = 0, w = 0
  logical :: ac(100000) = .false.
  character(1) :: s
  read(*,*) n, m
  do i = 1, m
    read(*,*) p, s
    ac(p) = ac(p) .or. s == "A"
    if (ac(p)) cycle
    wa(p) = wa(p)+1
  end do
  do i = 1, n
    if (ac(i)) then
      a = a+1
      w = w+wa(i)
    end if
  end do
  write(*,'(i0,x,i0)') a, w
end program welcome_to_atcoder