#include <cstdio>
#include <set>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;
#define NAME "webbuy"

const int N = 1e5 + 10;
const long long INF = 1e17;
char s[N];
int z[N];
long long d[N];
priority_queue<pair<long long, int> > q;

void relax(int from, int to, long long weight) {
    d[to] = weight;
    q.push(make_pair(-weight, to));
}

int main() {
	freopen(NAME".in", "r", stdin);
	freopen(NAME".out", "w", stdout);
	int n, a, b, c;
	cin >> n;
	scanf("%s", s);
	cin >> a >> b >> c;
	for (int i = 1, l = 0, r = 0; i < n; ++i) {
	    if (i <= r) z[i] = min(r - i + 1, z[i - l]);
	    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];
	    if (i + z[i] - 1 > r) {
	        l = i;
	        r = l + z[i] - 1;
	    }
	}
	for (int i = 0; i <= n; ++i)
        d[i] = INF;
    d[0] = 0;
    q.push(make_pair(0, 0));
    while (!q.empty()) {
        pair <long long, int> val = q.top();
        q.pop();
        if (-val.first != d[val.second]) continue;
        int len = val.second;

        if (len + 1 <= n && d[len] + a < d[len + 1])
            relax(len, len + 1, d[len] + a);

        if (len > 0 && d[len] + c < d[len - 1])
            relax(len, len - 1, d[len] + c);
        if (len >= n || len == 0) continue;

        int mn = min(z[len], len);
        long long cost = b + 1LL * (len - mn) * c;
        if (d[len + mn] > d[len] + cost)
            relax(len, len + mn, d[len] + cost);
    }
    cout << d[n];
    return 0;
}
