n,k=gets.split.map(&:to_i)
a,b,c=gets.split.map(&:to_i)
point = Hash[?r,c,?s,a,?p,b]

p gets.chomp.chars.each_slice(k).to_a.tap{|*,la|
  la[k-1]=la[k-1]
}.transpose.flat_map{|l|
  pre = nil
  l.map{|i|
    if pre == i
      pre = nil
      0
    else
      pre = i
      point[i]
    end
  }
}.compact.inject(:+)