program ddd
implicit none

integer :: n, k, r, s, p, i, res
character(10**5) :: t

read*, n, k
read*, r, s, p
read*, t

res = 0

do i = 1, n
	if (t(i:i)=='r') res=res + p
    if (t(i:i)=='s') res=res + r
	if (t(i:i)=='p') res=res + s
end do