program sample
    implicit none
    character(2)::s
    integer(8) :: i,j,m,n,w,p
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) n,m
    allocate(x(n),y(n))
    x(:)=0
    y(:)=0
    w=0
    if(m==0)then
        write(*,*)0,0
        stop
    end if

    do i=1,m
        read(*,*)p,s
        if(s .eq. 'AC')then
            x(p)=1
        else if(x(p)==0)then
            y(p)=y(p)+1
        end if
    end do
    do i=1,n
        if(x(i)==0)then
            y(i)=0
        endif
    end do



    write(*,*) sum(x),sum(y)
  
    stop
end program sample
  

