/* صل علي محمد ﷺ*/
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
#include <unordered_map>
#include <unordered_set>
#define IOS ios_base::sync_with_stdio(0);\
cin.tie(NULL);cout.tie(NULL);
#define OO 0x3f3f3f3f
#define endd "\n"
#define sett cout<< fixed << showpoint\
<< setprecision
#define ff first
#define ss second
#define sz(s) ((int)(s).size())
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define File ofstream coutt("outt.txt");\
ifstream cinn("inn.txt");
#define ordered_set tree<int, null_type,\
less_equal<int>, rb_tree_tag,\
tree_order_statistics_node_update>
#define pii pair<int,int>
typedef long long ll;
typedef double dd;
int dy[] = { -1, 1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
/// priority_queue<ll, vector<ll>, greater<ll>>q;
using namespace std;
/* صل علي محمد ﷺ*/
vector<int> KMP(string& s) {
int n = s.size();
vector<int> fail(n);
for (int i = 1; i < n; i++) {
int j = fail[i - 1];
while (j > 0 and s[j] != s[i])
j = fail[j - 1];
j += s[i] == s[j];
fail[i] = j;
}
return fail;
}
void solve() {
ll n, x, y, z;
cin >> n >> x >> y >> z;
string s; cin >> s;
vector<int>pre = KMP(s);
//for (int i = 0; i < n; i++)cout << pre[i]; cout << '\n';
reverse(all(s));
vector<int>suf = KMP(s);
reverse(all(suf));
int l = 1, r = n - 2;
ll ans = 0;
//for (int i = 0; i < n; ++i)cout << i; cout << '\n';
while (l < r) {
if (!pre[l])l++;
if (!suf[r])r--;
if (!pre[l] || !suf[r])continue;
if (l >= r)continue;
ll calc = pre[l] * x + suf[r] * y - z + (r - l) * z;
//cout << l << ' ' << r <<' '<< calc << '\n';
//cout << pre[l] << ' ' << suf[r] << '\n';
ans = max(ans, calc);
if (x >= z) l++;
if (y >= z) r--;
if (z >= x and z >= y)break;
}
cout << ans;
}
int main() {
//freopen("Input.in", "r", stdin);
//freopen("Output.txt", "w", stdout);
IOS;
//cout << mx;
int test_cases = 1;
//cin >> test_cases;
for (int i = 1; i <= test_cases; i++) {
solve();
//cout << endd;
}
}
Lyog2LXZhCDYudmE2Yog2YXYrdmF2K8g77e6Ki8KCgojaW5jbHVkZSAgICAgICAgICAgICAgICAgICA8Yml0cy9zdGRjKysuaD4KLy8jaW5jbHVkZSA8ZXh0L3BiX2RzL2Fzc29jX2NvbnRhaW5lci5ocHA+Ci8vI2luY2x1ZGUgPGV4dC9wYl9kcy90cmVlX3BvbGljeS5ocHA+Ci8vdXNpbmcgbmFtZXNwYWNlIF9fZ251X3BiZHM7CiNpbmNsdWRlICAgICAgICAgICAgICAgICAgIDx1bm9yZGVyZWRfbWFwPgojaW5jbHVkZSAgICAgICAgICAgICAgICAgICA8dW5vcmRlcmVkX3NldD4KI2RlZmluZSBJT1MgICAgICAgICAgICAgICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbygwKTtcCiAgICAgICAgICAgICAgICAgICAgICAgICAgIGNpbi50aWUoTlVMTCk7Y291dC50aWUoTlVMTCk7IAojZGVmaW5lIE9PICAgICAgICAgICAgICAgICAweDNmM2YzZjNmCiNkZWZpbmUgZW5kZCAgICAgICAgICAgICAgICJcbiIKI2RlZmluZSBzZXR0ICAgICAgICAgICAgICAgY291dDw8IGZpeGVkIDw8IHNob3dwb2ludFwKICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgc2V0cHJlY2lzaW9uCiNkZWZpbmUgZmYgICAgICAgICAgICAgICAgIGZpcnN0CiNkZWZpbmUgc3MgICAgICAgICAgICAgICAgIHNlY29uZAojZGVmaW5lIHN6KHMpICAgICAgICAgICAgICAoKGludCkocykuc2l6ZSgpKQojZGVmaW5lIGFsbCh2KSAgICAgICAgICAgICAodikuYmVnaW4oKSwodikuZW5kKCkKI2RlZmluZSByYWxsKHYpICAgICAgICAgICAgKHYpLnJiZWdpbigpLCh2KS5yZW5kKCkKI2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