#include <cstdio>
#include <set>
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

const long long INF = (long long)1e18;

vector<int> z_function(string s)
{
    vector<int> z(s.size(), 0);
    int l = 0, r = 0;
    for (int i = 1; i < (int)s.size(); i++)
    {
        if (i <= r)
            z[i] = min(r - i + 1, z[i - l]);
        while (z[i] + i < (int)s.size() && s[z[i]] == s[z[i] + i])
            z[i]++;
        if (z[i] + i - 1 > r)
            l = i, r = z[i] + i - 1;    
    }
    return z;
}


int main()
{
    string s;
    long long a, b, c;
    int n;
    freopen("webbuy.in", "r", stdin);
    freopen("webbuy.out", "w", stdout);
    cin >> n >> s >> a >> b >> c;
    vector<int> z = z_function(s);
    vector<long long> d(n, INF);
    vector<pair<int, int> > p(n);
    d[0] = a;
    p[0] = make_pair(-1, 0);
    set<pair<long long, int> > q;
    q.insert(make_pair(d[0], 0));
    while (!q.empty())
    {
        int v = q.begin()->second;
        q.erase(q.begin());
        int to;
        long long cost;
        //1)double string
        if (v + 1 < n)
        {
            int per = min(v + 1, z[v + 1]);
            to = v + per;
            cost = b + (v + 1 - per) * c;
            if (d[v] + cost < d[to])
            {  
                q.erase(make_pair(d[to], to));
                d[to] = d[v] + cost;
                p[to] = make_pair(v, 2);
                q.insert(make_pair(d[to], to));
            }
        }
        //2)insert letter
        if (v + 1 < n)
        {
            to = v + 1;
            cost = a;
            if (d[v] + cost < d[to])
            {
                q.erase(make_pair(d[to], to));
                d[to] = d[v] + cost;
                p[to] = make_pair(v, 1);
                q.insert(make_pair(d[to], to));
            }
        }
        //3)delete letter
        if (v - 1 >= 0)
        {
            to = v - 1;
            cost = c;
            if (d[v] + cost < d[to])
            {
                q.erase(make_pair(d[to], to));
                d[to] = d[v] + cost;
                p[to] = make_pair(v, 3);
                q.insert(make_pair(d[to], to));
            }
        }
    }
    cout << d[n - 1] << endl;
    /*vector<int> ans;
    int i = n - 1;
    while (p[i].second != 0)
    {
        int prev = p[i].first;
        int type = p[i].second;
        if (type == 1 || type == 3)
            ans.push_back(type);
        else
        {
            int per = i - prev;
            for (int i = 0; i < prev + 1 - per; i++)
                ans.push_back(3);
            ans.push_back(2);        
        }
        i = prev;
    }
    ans.push_back(1);
    reverse(ans.begin(), ans.end());
    cout << ans.size() << endl;
    for (int i = 0; i < (int)ans.size(); i++)
        cout << ans[i] << ' ';
    cout << endl; */
    return 0;
}