Imports System

Public Class Program


    Public Shared Sub Main(args As String())

        Dim input1() As Integer = Array.ConvertAll(Of String, Integer)(Console.ReadLine.Split(" "), AddressOf Integer.Parse)
        Dim N As Integer = input1(0)
        Dim K As Integer = input1(1)


        Dim input2() As Integer = Array.ConvertAll(Of String, Integer)(Console.ReadLine.Split(" "), AddressOf Integer.Parse)
        Dim R As Integer = input2(0)
        Dim S As Integer = input2(1)
        Dim P As Integer = input2(2)


        Dim T As String = Console.ReadLine
        Dim hands(K - 1) As String

        For i As Integer = 0 To N - 1
            hands(i Mod K) &= T(i)
        Next

        Dim score As ULong = 0


        For h As Integer = 0 To hands.Length - 1

            For i As Integer = 0 To hands(h).Length - 1


                If Not (i = 0) Then
                    If hands(h)(i) = hands(h)(i - 1) Then
                        hands(h) = hands(h).Remove(i, 1)
                        hands(h) = hands(h).Insert(i, "x")
                    End If

                End If

                Select Case hands(h)(i)
                    Case "r"
                        score += P
                    Case "s"
                        score += R
                    Case "p"
                        score += S
                End Select


            Next


        Next


        Console.WriteLine(score)

    End Sub



End Class
