program main

  implicit none

  integer :: inn, ink, inr, ins, inp
  integer :: i,j, k, cr, cs, cp, ca, point
  character(100000) :: innt
  integer :: prime

  read(*,*) inn, ink
  read(*,*) inr, ins, inp
  read(*,*) innt

  cr = 0
  cs = 0
  cp = 0
  ca = 0
  do i = inn, 1, -1
    if( innt(i:i) == "r" ) then
      cp = cp + 1
    else if( innt(i:i) == "s" ) then
      cr = cr + 1
    else if( innt(i:i) == "p" ) then
      cs = cs + 1
    end if
    if( innt(i:i) == innt(i-ink:i-ink) .and. (i-ink) > 1 ) then
      if( innt(i:i) == "r" ) then
        cp = cp - 1
      else if( innt(i:i) == "s" ) then
        cr = cr - 1
      else if( innt(i:i) == "p" ) then
        cs = cs - 1
      end if
    end if
  end do

  point = cr * inr + cs * ins + cp * inp
  print*, point


end program main