n, k = gets.split.map &:to_i
r, s, p = gets.split.map &:to_i
t = gets.chomp.split('').map{|c| c=='r' ? p : c=='s' ? r : s}

p (0...k).map{|m, pc|
    t.select.with_index{|_,i| i%k == m}.map{|e|
        pc = e == pc ? 0 : e
    }.inject(:+)
}.inject(:+)