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

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;
    int a, b, c, n;
    freopen("webbuy.in", "r", stdin);
    freopen("webbuy.out", "w", stdout);
    cin >> n >> s >> a >> b >> c;
    vector<int> z = z_function(s);
    long long ans = 0;
    for (int i = 0; i < (int)s.size(); i += z[i] + 1)
    {
        if (z[i] == 0)
            ans += a;
        else
        {
            long long cost_a = 1ll * z[i + 1] * a;
            long long cost_b = b;
            ans += min(cost_a, cost_b);
        }
    }
    cout << ans << endl;
    return 0;
}