program ABC149D
    implicit none
    integer::N,K
    integer::R,S,P
    character(10**5)::T
    integer::ans
    integer::i
    read*,N,K
    read*,R,S,P
    read*,T
    ans=0
    do i=1,K
        if(T(i:i)=="s")ans=ans+R
        if(T(i:i)=="p")ans=ans+S
        if(T(i:i)=="r")ans=ans+P
    end do
    do i=K+1,N
        if(T(i:i)==T(i-K:i-K))T(i:i)="n"
        if(T(i:i)=="s")ans=ans+R
        if(T(i:i)=="p")ans=ans+S
        if(T(i:i)=="r")ans=ans+P
    end do
    print"(i0)",ans
end program ABC149D