using System;
using System.Collections.Generic;
using System.Windows;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    public class Program
    {
        static void Main(string[] args)
        {
            var r1 = ReadSplit();
            var n = r1[0].ToInt();
            var k = r1[1].ToInt();
            var r2 = ReadSplit();
            var r = r2[0].ToInt();
            var s = r2[1].ToInt();
            var p = r2[2].ToInt();
            var t = Read();
            var l = new string[n];
            var win = new List<string>();
            for (int i = 0; i < n; i++)
            {
                var pre = string.Empty;
                var cur = string.Empty;
                var fut = string.Empty;
                if (i - k >= 0)
                {
                    pre = l[i - k];
                }
                if (i + k < n)
                {
                    fut = t[i + k].ToString();
                }
                cur = t[i].ToString();
                var getWinHand = new Func<string, string>(x =>
                {
                    if (x == "r")
                    {
                        return "p";
                    }
                    else if (x == "s")
                    {
                        return "r";
                    }
                    else
                    {
                        return "s";
                    }
                });

                var getEvenHand = new Func<string, string>(x =>
                {
                    if (x == "r")
                    {
                        return "r";
                    }
                    else if (x == "s")
                    {
                        return "s";
                    }
                    else
                    {
                        return "p";
                    }
                });

                var getLoseHand = new Func<string, string>(x =>
                {
                    if (x == "r")
                    {
                        return "s";
                    }
                    else if (x == "s")
                    {
                        return "p";
                    }
                    else
                    {
                        return "r";
                    }
                });

                var tmp = string.Empty;

                if (pre == getWinHand(cur))
                {
                    var even = getEvenHand(cur);
                    var lose = getLoseHand(cur);
                    if (even == getWinHand(fut))
                    {
                        tmp = lose;
                    }
                    if (lose == getWinHand(fut))
                    {
                        tmp = even;
                    }
                }
                else
                {
                    tmp = getWinHand(cur);
                    win.Add(tmp);
                }
                l[i] = tmp;
            }
            var ans = 0;
            foreach (var hand in win)
            {
                if (hand == "r")
                {
                    ans += r;
                }
                else if (hand == "s")
                {
                    ans += s;
                }
                else
                {
                    ans += p;
                }
            }
            WriteRead(ans);
        }

        public static string Read()
        {
            return Console.ReadLine();
        }

        public static string[] ReadSplit()
        {
            return Console.ReadLine().Split(' ');
        }

        public static void WriteRead(object str)
        {
            Console.WriteLine(str);
            Read();
        }

        public static void Write(object str)
        {
            Console.WriteLine(str);
        }
    }
}


public static class Extentions
{
    public static int ToInt(this object obj)
    {
        return int.Parse(obj.ToString());
    }

    public static decimal ToDecimal(this object obj)
    {
        return decimal.Parse(obj.ToString());
    }

    public static double ToDouble(this object obj)
    {
        return double.Parse(obj.ToString());
    }

    public static T2 GetValueZero<T1, T2>(this Dictionary<T1, T2> d, T1 key) where T2 : struct
    {
        T2 value;
        if (d.TryGetValue(key, out value))
        {
            return value;
        }
        return new T2();
    }
}



Measured memory_bytes: 21980