#include <iostream>
#include <cstring>
using namespace std;
int n;
int a,b,k,j;
typedef long long ll;
const int mod=1e9+7;
const int aa=354;
const int bb=673;
const int maxn=5005;
char s[maxn];
int dp[maxn];
int yuan[maxn];
struct node{
	ll a,b;
	bool operator ==(const node c)const {
		return (a==c.a)&&(b==c.b);
	}
};
node hh[maxn],u,v;
ll qpow(ll a,int b){
	ll c=1;
	while (b>0){
		if (b&1)
			c=c*a%mod;
		b>>=1;
		a=a*a%mod;
	}
	return c;
}
node get(node a,node b,int len){
	node c={(a.a*qpow(aa,len))%mod,(a.b*qpow(bb,len))%mod};
	return {((b.a-c.a)%mod+mod)%mod,((b.b-c.b)%mod+mod)%mod};
}
int main(){
	cin >> n >> a >> b;
	scanf("%s",s+1);
	for (int i=1;i<=n;i++){
		hh[i].a=(hh[i-1].a*aa+s[i]-'a')%mod;
		hh[i].b=(hh[i-1].b*bb+s[i]-'a')%mod;
	}
	for (int i=1;i<=n;i++){
		j=1;
		int l=i,r=n;
		while (l<=r){
			int mid=l+r>>1,len=mid-i+1;
			bool flag=false;
			u=get(hh[i-1],hh[i+len-1],len);
			for (int k=1;k<=i-1;k++){
				if (k+len-1>=i) break;
				v=get(hh[k-1],hh[k+len-1],len);
				if (u==v){
					flag=true;
					break;
				}
			}
			if (flag)
				l=mid+1;
			else
				r=mid-1;
		}
		if (r>=i)
			yuan[i]=r;
		else
			yuan[i]=-1;
	}/*
	for (int i=1;i<=n;i++){
		cout << yuan[i] << ' ';
	}
	cout << endl;*/
	memset(dp,1,sizeof(dp));
	dp[0]=0;
	for (int i=0;i<n;i++){
		for (int j=i+1;j<=yuan[i+1];j++){
			dp[j]=min(dp[j],dp[i]+b);
		}
		dp[i+1]=min(dp[i+1],dp[i]+a);
	}
	cout << dp[n];
}


#include <iostream>
#include <cstring>
using namespace std;
int n;
int a,b,k,j;
typedef long long ll;
const int mod=1e9+7;
const int aa=354;
const int bb=673;
const int maxn=5005;
char s[maxn];
int dp[maxn];
int yuan[maxn];
struct node{
	ll a,b;
	bool operator ==(const node c)const {
		return (a==c.a)&&(b==c.b);
	}
};
node hh[maxn],u,v;
ll qpow(ll a,int b){
	ll c=1;
	while (b>0){
		if (b&1)
			c=c*a%mod;
		b>>=1;
		a=a*a%mod;
	}
	return c;
}
node get(node a,node b,int len){
	node c={(a.a*qpow(aa,len))%mod,(a.b*qpow(bb,len))%mod};
	return {((b.a-c.a)%mod+mod)%mod,((b.b-c.b)%mod+mod)%mod};
}
int main(){
	cin >> n >> a >> b;
	scanf("%s",s+1);
	for (int i=1;i<=n;i++){
		hh[i].a=(hh[i-1].a*aa+s[i]-'a')%mod;
		hh[i].b=(hh[i-1].b*bb+s[i]-'a')%mod;
	}
	for (int i=1;i<=n;i++){
		j=1;
		int l=i,r=n;
		while (l<=r){
			int mid=l+r>>1,len=mid-i+1;
			bool flag=false;
			u=get(hh[i-1],hh[i+len-1],len);
			for (int k=1;k<=i-1;k++){
				if (k+len-1>=i) break;
				v=get(hh[k],hh[k+len-1],len);
				if (u==v){
					flag=true;
					break;
				}
			}
			if (flag)
				l=mid+1;
			else
				r=mid-1;
		}
		if (r>=i)
			yuan[i]=r;
		else
			yuan[i]=-1;
	}
	memset(dp,1,sizeof(dp));
	dp[0]=0;
	for (int i=0;i<n;i++){
		for (int j=i+1;j<=yuan[i+1];j++){
			dp[j]=min(dp[j],dp[i]+b);
		}
		dp[i+1]=min(dp[i+1],dp[i]+a);
	}
	cout << dp[n];
}


#include <iostream>
#include <cstring>
using namespace std;
int n;
int a,b,k,j;
typedef long long ll;
const int mod=1e9+7;
const int aa=354;
const int bb=673;
const int maxn=5005;
char s[maxn];
int dp[maxn];
int yuan[maxn];
struct node{
	ll a,b;
	bool operator ==(const node c)const {
		return (a==c.a)&&(b==c.b);
	}
};
node hh[maxn],u,v;
bool flag;
int l,r,mid,len;
ll qpow(ll a,int b){
	ll c=1;
	while (b>0){
		if (b&1)
			c=c*a%mod;
		b>>=1;
		a=a*a%mod;
	}
	return c;
}
node get(node a,node b,int len){
	node c={(a.a*qpow(aa,len))%mod,(a.b*qpow(bb,len))%mod};
	return {((b.a-c.a)%mod+mod)%mod,((b.b-c.b)%mod+mod)%mod};
}
int main(){
	scanf("%d%d%d",&n,&a,&b);
	scanf("%s",s+1);
	for (int i=1;i<=n;i++){
		hh[i].a=(hh[i-1].a*aa+s[i]-'a')%mod;
		hh[i].b=(hh[i-1].b*bb+s[i]-'a')%mod;
	}
	for (int i=1;i<=n;i++){
		j=1;
		l=i,r=n;
		while (l<=r){
			mid=l+r>>1,len=mid-i+1;
			flag=false;
			u=get(hh[i-1],hh[i+len-1],len);
			for (int k=1;k<=i-1;k++){
				if (k+len-1>=i) break;
				v=get(hh[k-1],hh[k+len-1],len);
				if (u==v){
					flag=true;
					break;
				}
			}
			if (flag)
				l=mid+1;
			else
				r=mid-1;
		}
		if (r>=i)
			yuan[i]=r;
		else
			yuan[i]=-1;
	}/*
	for (int i=1;i<=n;i++){
		cout << yuan[i] << ' ';
	}
	cout << endl;*/
	memset(dp,1,sizeof(dp));
	dp[0]=0;
	for (int i=0;i<n;i++){
		for (int j=i+1;j<=yuan[i+1];j++){
			dp[j]=min(dp[j],dp[i]+b);
		}
		dp[i+1]=min(dp[i+1],dp[i]+a);
	}
	cout << dp[n];
}


#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cmath>
#include<set>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
using namespace std;
const int maxn= 5e5,base=37;
const int mo=1e9+7;
int h[maxn],d[maxn];
char s[maxn];
set<int> S;
int n,a,b,ans;
int get(int i,int j){
	int re=h[j]-(ll)h[i-1]*d[j-i+1]%mo;
	if (re<0)
		re+=mo;
	return re;
}
int cti(char c){
	return c-'a'+1;
}
int getNex(int o){
	int l=o-1,r=min(2*o-1,n+1);
	while (l+1<r){
		int m=(l+r)>>1;
		int x=get(o,m);
		if (S.count(x)){
			l=m;
		}else{
			r=m;
		}
	}
	int cost;
	if (l==o-1){
		cost=a;
		l=o;
	}else
		cost=min(b,a*(l-o+1));
	ans+=cost;
	return l;
}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
	freopen("1.out","w",stdout);
#endif
	scanf("%d%d%d",&n, &a, &b);
	scanf("%s",s+1);
	d[0]=1;
	for (int i=1;i<=n;i++){
		h[i]=((ll)h[i-1]*base+cti(s[i]))%mo;
		d[i]=(ll)d[i-1]*base%mo;
	}
	ans=a;
	S.insert(get(1,1));
	int j;
	for (int i=2;i<=n;i=j+1){
		j=getNex(i);
		for (int k=i;k<=j;k++)
			for (int z=1;z<=k;z++){
				S.insert(get(z,k));
			}
	}
	printf("%d",ans);
	return 0;
}


#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cmath>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
using namespace std;
const int maxn= 5e3+10;
char s[maxn];
int f[maxn],g[maxn];
int n,a,b;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
	freopen("1.out","w",stdout);
#endif
	scanf("%d%d%d",&n, &a, &b);
	scanf("%s",s+1);
	f[1]=a;
	for (int i=2;i<=n;i++){
		f[i]=f[i-1]+a;
		for (int j=i-1;j>0;j--){
			if (s[j]==s[i]){
				g[j]=g[j-1]+1;
				f[i]=min(f[i],f[max(i-g[j],j)]+b);
			}
		}
	}
	printf("%d",f[n]);
	return 0;
}


#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cmath>
#include<set>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
using namespace std;
const int maxn= 5e5,base=37;
const int mo=1e9+7;
int h[maxn],d[maxn];
char s[maxn];
set<int> S;
int n,a,b,ans;
int get(int i,int j){
	int re=h[j]-(ll)h[i-1]*d[j-i+1]%mo;
	if (re<0)
		re+=mo;
	return re;
}
int cti(char c){
	return c-'a';
}
int getNex(int o){
	int l=o-1,r=2*o-1;
	while (l+1<r){
		int m=(l+r)>>1;
		int x=get(o,m);
		if (S.count(x)){
			l=m;
		}else{
			r=m;
		}
	}
	int cost;
	if (l==o-1){
		cost=a;
		l=o;
	}else
		cost=min(b,a*(l-o+1));
	ans+=cost;
	return l;
}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
	freopen("1.out","w",stdout);
#endif
	scanf("%d%d%d",&n, &a, &b);
	scanf("%s",s+1);
	d[0]=1;
	for (int i=1;i<=n;i++){
		h[i]=((ll)h[i-1]*base+cti(s[i]))%mo;
		d[i]=(ll)d[i-1]*base%mo;
	}
	ans=a;
	S.insert(get(1,1));
	int j;
	for (int i=2;i<=n;i=j+1){
		j=getNex(i);
		for (int k=i;k<=j;k++)
			for (int z=1;z<=k;z++){
				S.insert(get(z,k));
			}
	}
	printf("%d",ans);
	return 0;
}


#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cmath>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
using namespace std;
const int maxn= 5e3+10;
char s[maxn];
int f[maxn],g[maxn];
int n,a,b;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
	freopen("1.out","w",stdout);
#endif
	scanf("%d%d%d",&n, &a, &b);
	scanf("%s",s+1);
	f[1]=a;
	for (int i=2;i<=n;i++){
		f[i]=f[i-1]+a;
		for (int j=i-1;j>0;j--){
			if (s[j]==s[i]){
				g[j]=g[j-1]+1;
				f[i]=min(f[i],f[max(i-g[j],j)]+b);
			}else
				g[j]=0;
		}
	}
	printf("%d",f[n]);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vi = vector<int>;

const int N = 2;
const int MAX = 5010;
ll p[N][MAX];
int MOD[N];
ll s[N][MAX];
ll r[MAX];
array <ll,N> F[MAX][MAX];

map <array<ll,N>,int> M;

void rhash(int l,int r){
	for(int i=0;i<N;i++){
		ll q = 0;
		if( l ) q = s[i][l-1];
		F[l][r][i] = (s[i][r] - (q*p[i][r-l+1])%MOD[i] + MOD[i])%MOD[i];
	}
}

int find(int l,int p){
	auto x = F[p-l+1][p];
	for(int i=0;i+l-1 < p-l+1;i++){
		if( F[i][i+l-1] == x) return 1;
	}
	return 0;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string cad;
	int n,a,b;
	cin >> n >> a >> b;
	cin >> cad;
	srand(time(NULL));
	for(int i=0;i<N;i++){
		MOD[i] = (1e9) + (rand() % MAX);
	}
	for(int i=0;i<N;i++){
		s[i][0] = cad[0] - 'a' + 1;
		p[i][0] = 1;
		for(int j=1;j<=n;j++){
			s[i][j] = (s[i][j-1]*27 + (cad[j] - 'a' + 1) )%MOD[i];
			p[i][j] = (p[i][j-1]*27)%MOD[i];
		}
	}
	for(int i=0;i<n;i++){
		for(int j=i;j<n;j++){
			rhash(i,j);
		}
	}
	for(int i=0;i<n;i++){
		if( i ) r[i] = r[i-1] + a;
		else r[i] = a;
		if( !find(1,i) ) continue;
		int lo = 1;
		int hi = i/2+1;
		while( find(lo+1,i) ){
			int cen = (lo+hi+1)/2;
			if( find(cen,i) ) lo = cen;
			else hi = cen;
		}
		r[i] = min(r[i],r[i-lo] + b);
	}
	cout << r[n-1] << "\n";
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vi = vector<int>;

const int N = 1;
const int MAX = 5010;
ll p[N][MAX];
int MOD[N];
ll s[N][MAX];
ll r[MAX];

map <array<ll,N>,int> M;

array<ll,N> rhash(int l,int r){
	array <ll,N> temp;
	for(int i=0;i<N;i++){
		ll q = 0;
		if( l ) q = s[i][l-1];
		temp[i] = (s[i][r] - (q*p[i][r-l+1])%MOD[i] + MOD[i])%MOD[i];
	}
	return temp;
}

int find(int l,int p){
	auto x = rhash(p-l+1,p);
	for(int i=0;i+l-1 < p-l+1;i++){
		if( rhash(i,i+l-1) == x) return 1;
	}
	return 0;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string cad;
	int n,a,b;
	cin >> n >> a >> b;
	cin >> cad;
	srand(time(NULL));
	for(int i=0;i<N;i++){
		MOD[i] = (1e9+1) + (rand() % MAX);
	}
	for(int i=0;i<N;i++){
		s[i][0] = cad[0] - 'a' + 1;
		p[i][0] = 1;
		for(int j=1;j<=n;j++){
			s[i][j] = (s[i][j-1]*27 + (cad[j] - 'a' + 1) )%MOD[i];
			p[i][j] = (p[i][j-1]*27)%MOD[i];
		}
	}
	for(int i=0;i<n;i++){
		if( i ) r[i] = r[i-1] + a;
		else r[i] = a;
		if( !find(1,i) ) continue;
		int lo = 1;
		int hi = i+1;
		while( find(lo+1,i) ){
			int cen = (lo+hi+1)/2;
			if( find(cen,i) ) lo = cen;
			else hi = cen;
		}
		r[i] = min(r[i],r[i-lo] + b);
	}
	cout << r[n-1] << "\n";
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vi = vector<int>;

const int N = 1;
const int MAX = 5010;
ll p[N][MAX];
int MOD[N];
ll s[N][MAX];
ll r[MAX];

map <array<ll,N>,int> M;

array<ll,N> rhash(int l,int r){
	array <ll,N> temp;
	for(int i=0;i<N;i++){
		ll q = 0;
		if( l ) q = s[i][l-1];
		temp[i] = (s[i][r] - (q*p[i][r-l+1])%MOD[i] + MOD[i])%MOD[i];
	}
	return temp;
}

int find(int l,int p){
	auto x = rhash(p-l+1,p);
	for(int i=0;i+l-1 < p-l+1;i++){
		if( rhash(i,i+l-1) == x) return 1;
	}
	return 0;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string cad;
	int n,a,b;
	cin >> n >> a >> b;
	cin >> cad;
	srand(time(NULL));
	for(int i=0;i<N;i++){
		MOD[i] = (2e9+1) + (rand() % MAX);
	}
	for(int i=0;i<N;i++){
		s[i][0] = cad[0] - 'a' + 1;
		p[i][0] = 1;
		for(int j=1;j<=n;j++){
			s[i][j] = (s[i][j-1]*27 + (cad[j] - 'a' + 1) )%MOD[i];
			p[i][j] = (p[i][j-1]*27)%MOD[i];
		}
	}
	for(int i=0;i<n;i++){
		if( i ) r[i] = r[i-1] + a;
		else r[i] = a;
		if( !find(1,i) ) continue;
		int lo = 1;
		int hi = i+1;
		while( find(lo+1,i) ){
			int cen = (lo+hi+1)/2;
			if( find(cen,i) ) lo = cen;
			else hi = cen;
		}
		r[i] = min(r[i],r[i-lo] + b);
	}
	cout << r[n-1] << "\n";
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vi = vector<int>;

const int N = 4;
const int MAX = 5010;
ll p[N][MAX];
int MOD[N];
ll s[N][MAX];
ll r[MAX];

map <array<ll,N>,int> M;

array<ll,N> rhash(int l,int r){
	array <ll,N> temp;
	for(int i=0;i<N;i++){
		ll q = 0;
		if( l ) q = s[i][l-1];
		temp[i] = (s[i][r] - (q*p[i][r-l+1])%MOD[i] + MOD[i])%MOD[i];
	}
	return temp;
}

int find(int l,int p){
	auto x = rhash(p-l+1,p);
	for(int i=0;i+l-1 < p-l+1;i++){
		if( rhash(i,i+l-1) == x) return 1;
	}
	return 0;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string cad;
	int n,a,b;
	cin >> n >> a >> b;
	cin >> cad;
	srand(time(NULL));
	for(int i=0;i<N;i++){
		MOD[i] = (1e9) + (rand() % MAX);
	}
	for(int i=0;i<N;i++){
		s[i][0] = cad[0] - 'a' + 1;
		p[i][0] = 1;
		for(int j=1;j<=n;j++){
			s[i][j] = (s[i][j-1]*27 + (cad[j] - 'a' + 1) )%MOD[i];
			p[i][j] = (p[i][j-1]*27)%MOD[i];
		}
	}
	for(int i=0;i<n;i++){
		if( i ) r[i] = r[i-1] + a;
		else r[i] = a;
		if( !find(1,i) ) continue;
		int lo = 1;
		int hi = i+1;
		while( find(lo+1,i) ){
			int cen = (lo+hi+1)/2;
			if( find(cen,i) ) lo = cen;
			else hi = cen;
		}
		r[i] = min(r[i],r[i-lo] + b);
	}
	cout << r[n-1] << "\n";
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vi = vector<int>;

const int N = 1;
const int MAX = 5010;
ll p[N][MAX];
int MOD[N];
ll s[N][MAX];
ll r[MAX];

map <array<ll,N>,int> M;

array<ll,N> rhash(int l,int r){
	array <ll,N> temp;
	for(int i=0;i<N;i++){
		ll q = 0;
		if( l ) q = s[i][l-1];
		temp[i] = (s[i][r] - (q*p[i][r-l+1])%MOD[i] + MOD[i])%MOD[i];
	}
	return temp;
}

int find(int l,int p){
	auto x = rhash(p-l+1,p);
	for(int i=0;i+l-1 < p-l+1;i++){
		if( rhash(i,i+l-1) == x) return 1;
	}
	return 0;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string cad;
	int n,a,b;
	cin >> n >> a >> b;
	cin >> cad;
	srand(time(NULL));
	for(int i=0;i<N;i++){
		MOD[i] = (1e9) + (rand() % MAX);
	}
	for(int i=0;i<N;i++){
		s[i][0] = cad[0] - 'a' + 1;
		p[i][0] = 1;
		for(int j=1;j<=n;j++){
			s[i][j] = (s[i][j-1]*27 + (cad[j] - 'a' + 1) )%MOD[i];
			p[i][j] = (p[i][j-1]*27)%MOD[i];
		}
	}
	for(int i=0;i<n;i++){
		if( i ) r[i] = r[i-1] + a;
		else r[i] = a;
		if( !find(1,i) ) continue;
		int lo = 1;
		int hi = i+1;
		while( find(lo+1,i) ){
			int cen = (lo+hi+1)/2;
			if( find(cen,i) ) lo = cen;
			else hi = cen;
		}
		r[i] = min(r[i],r[i-lo] + b);
	}
	cout << r[n-1] << "\n";
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vi = vector<int>;

const int N = 2;
const int MAX = 5010;
ll p[N][MAX];
int MOD[N];
ll s[N][MAX];
ll r[MAX];

map <array<ll,N>,int> M;

array<ll,N> rhash(int l,int r){
	array <ll,N> temp;
	for(int i=0;i<N;i++){
		ll q = 0;
		if( l ) q = s[i][l-1];
		temp[i] = (s[i][r] - (q*p[i][r-l+1])%MOD[i] + MOD[i])%MOD[i];
	}
	return temp;
}

int find(int l,int p){
	auto x = rhash(p-l+1,p);
	for(int i=0;i+l-1 < p-l+1;i++){
		if( rhash(i,i+l-1) == x) return 1;
	}
	return 0;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string cad;
	int n,a,b;
	cin >> n >> a >> b;
	cin >> cad;
	srand(time(NULL));
	for(int i=0;i<N;i++){
		MOD[i] = (1e9) + (rand() % MAX);
	}
	for(int i=0;i<N;i++){
		s[i][0] = cad[0] - 'a' + 1;
		p[i][0] = 1;
		for(int j=1;j<=n;j++){
			s[i][j] = (s[i][j-1]*27 + (cad[j] - 'a' + 1) )%MOD[i];
			p[i][j] = (p[i][j-1]*27)%MOD[i];
		}
	}
	for(int i=0;i<n;i++){
		if( i ) r[i] = r[i-1] + a;
		else r[i] = a;
		if( !find(1,i) ) continue;
		int lo = 1;
		int hi = i+1;
		while( find(lo+1,i) ){
			int cen = (lo+hi+1)/2;
			if( find(cen,i) ) lo = cen;
			else hi = cen;
		}
		r[i] = min(r[i],r[i-lo] + b);
	}
	cout << r[n-1] << "\n";
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vi = vector<int>;

const int N = 4;
const int MAX = 5010;
ll p[N][MAX];
int MOD[N];
ll s[N][MAX];
ll r[MAX];

map <array<ll,N>,int> M;

array<ll,N> rhash(int l,int r){
	array <ll,N> temp;
	for(int i=0;i<N;i++){
		ll q = 0;
		if( l ) q = s[i][l-1];
		temp[i] = (s[i][r] - (q*p[i][r-l+1])%MOD[i] + MOD[i])%MOD[i];
	}
	return temp;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string cad;
	int n,a,b;
	cin >> n >> a >> b;
	cin >> cad;
	srand(time(NULL));
	for(int i=0;i<N;i++){
		MOD[i] = (1e9) + (rand() % MAX);
	}
	for(int i=0;i<N;i++){
		s[i][0] = cad[0] - 'a' + 1;
		p[i][0] = 1;
		for(int j=1;j<=n;j++){
			s[i][j] = (s[i][j-1]*27 + (cad[j] - 'a' + 1) )%MOD[i];
			p[i][j] = (p[i][j-1]*27)%MOD[i];
		}
	}
	for(int i=0;i<n;i++){
		if( i ) r[i] = r[i-1] + a;
		else r[i] = a;
		for(int j=0;j<=i;j++){
			auto x = rhash(j,i);
			if( M[x] == 0 ) M[x] = i+1;
		}
		for(int j=i-1;j>=0;j--){
			auto x = rhash(j+1,i);
			if( M[x] == 0){
				M.erase(x);
				break;
			}
			else{
				if( M[x] > j+1) break;
				r[i] = min(r[i],r[j] + b);
			}
		}
	}
	cout << r[n-1] << "\n";
}


#include <bits/stdc++.h>
#define f first
#define s second
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const ll INF = 1e9 + 7, mod = 998244353, MAXN = 2e5 + 5, SQ = 450, pp = 31;
const ld EPS = 1e-9, PI = acos(-1);

using namespace std;

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC optimize("fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("section-anchors")
/*#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
#pragma GCC optimize("vpt")
#pragma GCC optimize("rename-registers")
#pragma GCC optimize("move-loop-invariants")
#pragma GCC optimize("unswitch-loops")
#pragma GCC optimize("function-sections")
#pragma GCC optimize("data-sections")
#pragma GCC optimize("branch-target-load-optimize")
//#pragma GCC optimize("branch-target-load-optimize2")
#pragma GCC optimize("btr-bb-exclusive")*/

namespace in_out {
    template <typename T1, typename T2>
    ostream& operator<<(ostream& out, pair <T1, T2> a) {
        out << a.f << " " << a.s;
        return out;
    }

    template <typename T1, typename T2>
    istream& operator>>(istream& in, pair <T1, T2> &a) {
        in >> a.f >> a.s;
        return in;
    }

    template <typename T>
    ostream& operator<<(ostream& out, vector<T> a) {
        for (auto i : a)
            out << i << " ";
        return out;
    }

    template <typename T>
    istream& operator>>(istream& in, vector<T> &a) {
        for (auto & i : a)
            in >> i;
        return in;
    }
}

using namespace in_out;

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

    return z;
}

signed main() {
	ios_base::sync_with_stdio();
	cin.tie(0); cout.tie(0);

	#ifdef DEBUG
		ifstream cin("input.txt");
		ofstream cout("output.txt");
	#endif

    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;

    vector <int> dp(n, INF);
    dp[0] = a;
    for (int i = 1; i < n; i++) {
        dp[i] = dp[i - 1] + a;
        string t = s.substr(0, i + 1);
        reverse(all(t));

        vector <int> z = zet(t);
        //cerr << z << endl;
        for (int j = t.size() / 2; j < t.size(); j++)
            dp[i] = min(dp[i], dp[i - z[j]] + b);

    }

    //cerr << dp << endl;
    cout << dp[n - 1];

    return 0;
}


#include <bits/stdc++.h>
#define f first
#define s second
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const ll INF = 1e9 + 7, mod = 998244353, MAXN = 2e5 + 5, SQ = 450, pp = 31;
const ld EPS = 1e-9, PI = acos(-1);

using namespace std;

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC optimize("fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("section-anchors")
/*#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
#pragma GCC optimize("vpt")
#pragma GCC optimize("rename-registers")
#pragma GCC optimize("move-loop-invariants")
#pragma GCC optimize("unswitch-loops")
#pragma GCC optimize("function-sections")
#pragma GCC optimize("data-sections")
#pragma GCC optimize("branch-target-load-optimize")
//#pragma GCC optimize("branch-target-load-optimize2")
#pragma GCC optimize("btr-bb-exclusive")*/

namespace in_out {
    template <typename T1, typename T2>
    ostream& operator<<(ostream& out, pair <T1, T2> a) {
        out << a.f << " " << a.s;
        return out;
    }

    template <typename T1, typename T2>
    istream& operator>>(istream& in, pair <T1, T2> &a) {
        in >> a.f >> a.s;
        return in;
    }

    template <typename T>
    ostream& operator<<(ostream& out, vector<T> a) {
        for (auto i : a)
            out << i << " ";
        return out;
    }

    template <typename T>
    istream& operator>>(istream& in, vector<T> &a) {
        for (auto & i : a)
            in >> i;
        return in;
    }
}

using namespace in_out;

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

    return z;
}

signed main() {
	ios_base::sync_with_stdio();
	cin.tie(0); cout.tie(0);

	#ifdef DEBUG
		ifstream cin("input.txt");
		ofstream cout("output.txt");
	#endif

    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;

    vector <int> dp(n, INF);
    dp[0] = a;
    for (int i = 1; i < n; i++) {
        dp[i] = dp[i - 1] + a;
        string t = s.substr(0, i + 1);
        reverse(all(t));

        vector <int> z = zet(t);
        //cerr << z << endl;
        for (int j = 1; j < t.size(); j++)
            if (z[j] <= j)
                dp[i] = min(dp[i], dp[i - z[j]] + b);
    }

    //cerr << dp << endl;
    cout << dp[n - 1];

    return 0;
}


#include <bits/stdc++.h>
#define f first
#define s second
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const ll INF = 1e9 + 7, mod = 998244353, MAXN = 2e5 + 5, SQ = 450, pp = 31;
const ld EPS = 1e-9, PI = acos(-1);

using namespace std;

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC optimize("fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("section-anchors")
/*#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
#pragma GCC optimize("vpt")
#pragma GCC optimize("rename-registers")
#pragma GCC optimize("move-loop-invariants")
#pragma GCC optimize("unswitch-loops")
#pragma GCC optimize("function-sections")
#pragma GCC optimize("data-sections")
#pragma GCC optimize("branch-target-load-optimize")
//#pragma GCC optimize("branch-target-load-optimize2")
#pragma GCC optimize("btr-bb-exclusive")*/

namespace in_out {
    template <typename T1, typename T2>
    ostream& operator<<(ostream& out, pair <T1, T2> a) {
        out << a.f << " " << a.s;
        return out;
    }

    template <typename T1, typename T2>
    istream& operator>>(istream& in, pair <T1, T2> &a) {
        in >> a.f >> a.s;
        return in;
    }

    template <typename T>
    ostream& operator<<(ostream& out, vector<T> a) {
        for (auto i : a)
            out << i << " ";
        return out;
    }

    template <typename T>
    istream& operator>>(istream& in, vector<T> &a) {
        for (auto & i : a)
            in >> i;
        return in;
    }
}

using namespace in_out;

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

    return z;
}

signed main() {
	ios_base::sync_with_stdio();
	cin.tie(0); cout.tie(0);

	#ifdef DEBUG
		ifstream cin("input.txt");
		ofstream cout("output.txt");
	#endif

    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;

    vector <int> dp(n, INF);
    dp[0] = a;
    for (int i = 1; i < n; i++) {
        dp[i] = dp[i - 1] + a;
        string t = s.substr(0, i + 1);
        reverse(all(t));

        vector <int> z = zet(t);
        for (int j = (t.size() + 1) / 2; j < t.size(); j++)
            dp[i] = min(dp[i], dp[i - z[j]] + b);

    }

    //cerr << dp << endl;
    cout << dp[n - 1];

    return 0;
}


#include <bits/stdc++.h>
#define f first
#define s second
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const ll INF = 1e9 + 7, mod = 998244353, MAXN = 2e5 + 5, SQ = 450, pp = 31;
const ld EPS = 1e-9, PI = acos(-1);

using namespace std;

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC optimize("fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("section-anchors")
/*#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
#pragma GCC optimize("vpt")
#pragma GCC optimize("rename-registers")
#pragma GCC optimize("move-loop-invariants")
#pragma GCC optimize("unswitch-loops")
#pragma GCC optimize("function-sections")
#pragma GCC optimize("data-sections")
#pragma GCC optimize("branch-target-load-optimize")
//#pragma GCC optimize("branch-target-load-optimize2")
#pragma GCC optimize("btr-bb-exclusive")*/

namespace in_out {
    template <typename T1, typename T2>
    ostream& operator<<(ostream& out, pair <T1, T2> a) {
        out << a.f << " " << a.s;
        return out;
    }

    template <typename T1, typename T2>
    istream& operator>>(istream& in, pair <T1, T2> &a) {
        in >> a.f >> a.s;
        return in;
    }

    template <typename T>
    ostream& operator<<(ostream& out, vector<T> a) {
        for (auto i : a)
            out << i << " ";
        return out;
    }

    template <typename T>
    istream& operator>>(istream& in, vector<T> &a) {
        for (auto & i : a)
            in >> i;
        return in;
    }
}

using namespace in_out;

signed main() {
	ios_base::sync_with_stdio();
	cin.tie(0); cout.tie(0);

	#ifdef DEBUG
		ifstream cin("input.txt");
		ofstream cout("output.txt");
	#endif

    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;

    vector <int> dp(n, INF);
    dp[0] = a;
    for (int i = 1; i < n; i++) {
        dp[i] = dp[i - 1] + a;
        string t = s.substr(0, i + 1);
        reverse(all(t));

        vector <int> z(t.size());
        int l = 0, r = -1;
        for (int k = 1; k < t.size(); k++) {
            z[k] = max(0, min(r - k + 1, z[k - l]));
            while (z[k] + k < t.size() && t[z[k]] == t[z[k] + k])
                z[k]++;

            if (z[k] + k - 1 > r)
                r = z[k] + k - 1, l = k;
        }

        for (int j = 1; j < t.size(); j++)
            if (z[j] <= j)
                dp[i] = min(dp[i], dp[i - z[j]] + b);
    }

    cout << dp[n - 1];

    return 0;
}


#include<iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <fstream>

using namespace std;
vector<unsigned long long > hax;
vector<int> pre;
int P =41;
unsigned long long has(int l, int r)
{
	return (hax[r] - hax[l - 1] * pre[r - l + 1]);
}
int main() {
  ///  ifstream cin("input.txt");
  //  ofstream cout("output.txt");
	int n, a, b;
	cin >> n >> a >> b;
	hax.resize(n + 1);
	pre.resize(n + 1);
	pre[0] = 1;
	string s;

	cin >> s;
	for (int i = 0; i < n; i++)
	{
		pre[i + 1] = pre[i] * P;
		hax[i + 1] = hax[i] * P + s[i] -	'a';
	}
	vector<int> v;
	vector<set <unsigned long long > > sv;
	v.resize(n,1000000000);
	sv.resize(n);
	v[0] = a;
	sv[0].insert(has(1, 1));
	int l, r;

	for (int i = 0; i < n-1; i++)
	{
		v[i + 1] = min(v[i + 1], v[i] + a);
		l = -1; r = min(i, n - i-2) ;
		while (l < r)
		{
			int mi =( l + r+1) / 2;
			if (sv[mi].find(has(i + 2, i +2 + mi)) != sv[mi].end())
				l = mi;
			else
				r = mi - 1;
		}

		for (int j = i + 1 +l; j > i; j--)
		{
			v[j] = min(v[j], v[i] + b);
		}

		for (int j = i+1; j >=0; j--)
		{
			sv[ j].insert(has(i - j+2, i+2));
		}
	}
	cout << v[n - 1];
	cin >> v[n - 1];
}
///
//56 5 67
//bhcdbeeded.bhcdb.aededchgdfeecedfaegbccbedggcdfgdddeahcdee
///


#include<iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <fstream>

using namespace std;
vector<unsigned long long> hax;
vector<unsigned long long > pre;
int P =41;
unsigned long long has(int l, int r)
{
	return (hax[r] - hax[l - 1] * pre[r - l + 1]);
}
bool che(int n, int w,unsigned long long cuka)
{
	for (int i = w; i <= n; i++)
	{
		if (has(1+i - w,1+ i) == cuka)
			return true;
	}
	return false;
}
int main() {
  ///  ifstream cin("input.txt");
  //  ofstream cout("output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n, a, b;
	cin >> n >> a >> b;
	hax.resize(n + 1);
	pre.resize(n + 1);
	pre[0] = 1;
	string s;

	cin >> s;
	for (int i = 0; i < n; i++)
	{
		pre[i + 1] = pre[i] * P;
		hax[i + 1] = hax[i] * P + s[i] -	'a';
	}
	vector<int> v;
	v.resize(n,1000000000);
  v[0] = a;
	int l, r;
	for (int i = 0; i < n-1; i++)
	{
		v[i + 1] = min(v[i + 1], v[i] + a);
		l = -1; r = min(i, n - i-2) ;
		while (l < r)
		{
			int mi =( l + r+1) / 2;
			if (che(i,mi,has(i+1,i+1+mi)))
				l = mi;
			else
				r = mi - 1;

		}
		for (int j = i + 1 +l; j > i; j--)
		{
			v[j] = min(v[j], v[i] + b);
		}
	}
	cout << v[n - 1];
	cin >> v[n - 1];
}
///
//20
//4 13
//abacabagabadabacabag
                         //-13
///


#include<iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <fstream>

using namespace std;
vector<unsigned long long> hax;
vector<unsigned long long > pre;
int P =41;
unsigned long long has(int l, int r)
{
	return (hax[r] - hax[l - 1] * pre[r - l + 1]);
}
bool che(int n, int w,unsigned long long cuka)
{
	for (int i = w; i <= n; i++)
	{
		if (has(1+i - w,1+ i) == cuka)
			return true;
	}
	return false;
}
int main() {
  ///  ifstream cin("input.txt");
  //  ofstream cout("output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n, a, b;
	cin >> n >> a >> b;
	hax.resize(n + 1);
	pre.resize(n + 1);
	pre[0] = 1;
	string s;

	cin >> s;
	for (int i = 0; i < n; i++)
	{
		pre[i + 1] = pre[i] * P;
		hax[i + 1] = hax[i] * P + s[i] -	'a';
	}
	vector<int> v;
	v.resize(n,1000000000);
  v[0] = a;
	int l, r;
	for (int i = 0; i < n-1; i++)
	{
		v[i + 1] = min(v[i + 1], v[i] + a);
		l = -1; r = min(i, n - i-2) ;
		while (l < r)
		{
			int mi =( l + r+1) / 2;
			if (che(i,mi,has(i+2,i+2+mi)))
				l = mi;
			else
				r = mi - 1;

		}
		for (int j = i + 1 +l; j > i; j--)
		{
			v[j] = min(v[j], v[i] + b);
		}
	}
	cout << v[n - 1];
	cin >> v[n - 1];
}
///
//20
//4 13
//abacabagabadabacabag
                         //-13
///


#include<iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <fstream>

using namespace std;
vector<unsigned long long > hax;
vector<int> pre;
int P = 37;
unsigned long long has(int l, int r)
{
	return (hax[r] - hax[l - 1] * pre[r - l + 1]);
}
int main() {
  ///  ifstream cin("input.txt");
  //  ofstream cout("output.txt");
	int n, a, b;
	cin >> n >> a >> b;
	hax.resize(n + 1);
	pre.resize(n + 1);
	pre[0] = 1;
	string s;

	cin >> s;
	for (int i = 0; i < n; i++)
	{
		pre[i + 1] = pre[i] * P;
		hax[i + 1] = hax[i] * P + s[i] -	'a';
	}
	vector<int> v;
	vector<set <unsigned long long > > sv;
	v.resize(n,1000000000);
	sv.resize(n);
	v[0] = a;
	sv[0].insert(has(1, 1));
	int l, r;

	for (int i = 0; i < n; i++)
	{
		v[i + 1] = min(v[i + 1], v[i] + a);
		l = -1; r = min(i, n - i-2) ;
		while (l < r)
		{
			int mi =( l + r+1) / 2;
			if (sv[mi].find(has(i + 2, i +2 + mi)) != sv[mi].end())
				l = mi;
			else
				r = mi - 1;
		}

		for (int j = i + 1 +l; j > i; j--)
		{
			v[j] = min(v[j], v[i] + b);
		}
		if (v[n - 1] != 1000000000) { cout << v[n - 1]; return 0; }
		for (int j = i+1; j >=0; j--)
		{
			sv[ j].insert(has(i - j+2, i+2));
		}
	}
	cout << v[n - 1];

}


#include<iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <fstream>

using namespace std;
vector<unsigned long long > hax;
vector<int> pre;
int P = 37;
unsigned long long has(int l, int r)
{
	return (hax[r] - hax[l - 1] * pre[r - l + 1]);
}
int main() {
  ///  ifstream cin("input.txt");
  //  ofstream cout("output.txt");
	int n, a, b;
	cin >> n >> a >> b;
	hax.resize(n + 1);
	pre.resize(n + 1);
	pre[0] = 1;
	string s;

	cin >> s;
	for (int i = 0; i < n; i++)
	{
		pre[i + 1] = pre[i] * P;
		hax[i + 1] = hax[i] * P + s[i] -	'a';
	}
	vector<int> v;
	vector<set <unsigned long long > > sv;
	v.resize(n,1000000000);
	sv.resize(n);
	v[0] = a;
	sv[0].insert(has(1, 1));
	int l, r;

	for (int i = 0; i < n; i++)
	{
		v[i + 1] = min(v[i + 1], v[i] + a);
		l = -1; r = i ;
		while (l < r)
		{
			int mi =( l + r+1) / 2;
			if (sv[mi].find(has(i + 2, i +2 + mi)) != sv[mi].end())
				l = mi;
			else
				r = mi - 1;
		}
		v[i + l + 1] = min(v[i + l + 1], v[i] + b);
		if (v[n - 1] != 1000000000) { cout << v[n - 1]; return 0; }
		for (int j = i+1; j >=0; j--)
		{
			sv[ j].insert(has(i - j+2, i+2));
		}
	}
	cout << v[n - 1];

}


#include<iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <fstream>

using namespace std;
vector<unsigned long long> hax;
vector<unsigned long long > pre;
int P =41;
unsigned long long has(int l, int r)
{
	return (hax[r] - hax[l - 1] * pre[r - l + 1]);
}
int main() {
  ///  ifstream cin("input.txt");
  //  ofstream cout("output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n, a, b;
	cin >> n >> a >> b;
	hax.resize(n + 1);
	pre.resize(n + 1);
	pre[0] = 1;
	string s;

	cin >> s;
	for (int i = 0; i < n; i++)
	{
		pre[i + 1] = pre[i] * P;
		hax[i + 1] = hax[i] * P + s[i] -	'a';
	}
	vector<int> v;
	vector<set <unsigned long long > > sv;
	v.resize(n,1000000000);
	sv.resize(n);
	v[0] = a;
	sv[0].insert(has(1, 1));
	int l, r;

	for (int i = 0; i < n-1; i++)
	{
		v[i + 1] = min(v[i + 1], v[i] + a);
		l = -1; r = min(i, n - i-2) ;
		while (l < r)
		{
			int mi =( l + r+1) / 2;
			if (sv[mi].find(has(i + 2, i +2 + mi)) != sv[mi].end())
				l = mi;
			else
				r = mi - 1;
		}

		for (int j = i + 1 +l; j > i; j--)
		{
			v[j] = min(v[j], v[i] + b);
		}

		for (int j = i+1; j >=0; j--)
		{
			sv[ j].insert(has(i - j+2, i+2));
		}
	}
	cout << v[n - 1];
	cin >> v[n - 1];
}
///
//20
//4 13
//abacabagabadabacabag
                         //-13
///


#include <bits/stdc++.h>

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(a) (int)((a).size())
#define sqr(a) (a) * (a)
#define endl '\n'
#define DBG(a) cout << #a << " := " << a << endl

typedef long long LL;
typedef long double LD;

const int MAX = (int)(1e5) + 7;
const int MOD = (int)(1e9) + 7;
const int INF_I = (int)(1e9) + 7;
const LL INF_LL = (long long)(1e18) + 7;

using namespace std;

int n, a, b;
string s;
vector<int> dp;

template <typename T> void info(T& a) {
    for (auto &el: a) cout << el << ' ';
    cout << endl;
}

inline int input_I() {
    int a;
    cin >> a;
    return a;
}

inline long long input_LL() {
    long long a;
    cin >> a;
    return a;
}

void boot() {
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
}

void z_func(string& s, vector<int>& z) {
    int n = sz(s);
    int l = 0, r = 0;
    fill(all(z), 0);

    for (int i = 1; i < n; ++i) {
        if (i <= r) z[i] = min(z[i - l], r - i + 1);

        while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];

        if (i + z[i] - 1 > r) {
            l = i;
            r = i + z[i] - 1;
        }
    }
}

void solve() {
    cin >> s;

    dp.assign(n, 0);
    string global_pref = "";
    global_pref += s[0];
    dp[0] = a;

    for (int i = 1; i < n; ++i) {
        dp[i] = dp[i - 1] + a;
        global_pref += s[i];

        for (int j = 0; j < i; ++j) {
            if (s[i] == s[j]) {
                dp[i] = min(dp[i], dp[i - 1] + b);
                break;
            }
        }

        reverse(all(global_pref));

        vector<int> z(sz(global_pref));

        z_func(global_pref, z);

        vector<int> pref_mx(i + 1);

        pref_mx[i] = z[i];

        for (int j = i - 1; j >= 0; --j) pref_mx[j] = max(pref_mx[j + 1], z[j]);

        int pref_ln = 1;
        int suff_ln = i;

        for (; pref_ln <= suff_ln; ++pref_ln, --suff_ln) {
            if (pref_mx[pref_ln] >= pref_ln) {
                dp[i] = min(dp[i], dp[i - pref_ln] + b);
            }
        }

        reverse(all(global_pref));
    }

    // info(dp);

    cout << dp[n - 1] << endl;
}

signed main() {
    boot();

    while (cin >> n >> a >> b) solve();
}


#include <bits/stdc++.h>

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(a) (int)((a).size())
#define sqr(a) (a) * (a)
#define endl '\n'
#define DBG(a) cout << #a << " := " << a << endl

typedef long long LL;
typedef long double LD;

const int MAX = (int)(1e5) + 7;
const int MOD = (int)(1e9) + 7;
const int INF_I = (int)(1e9) + 7;
const LL INF_LL = (long long)(1e18) + 7;

using namespace std;

int n, a, b;
string s;
vector<int> dp;

template <typename T> void info(T& a) {
    for (auto &el: a) cout << el << ' ';
    cout << endl;
}

inline int input_I() {
    int a;
    cin >> a;
    return a;
}

inline long long input_LL() {
    long long a;
    cin >> a;
    return a;
}

void boot() {
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
}

void z_func(string& s, vector<int>& z) {
    int n = sz(s);
    int l = 0, r = 0;
    fill(all(z), 0);

    for (int i = 1; i < n; ++i) {
        if (i <= r) z[i] = min(z[i - l], r - i + 1);

        while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];

        if (i + z[i] - 1 > r) {
            l = i;
            r = i + z[i] - 1;
        }
    }
}

bool is_substring(string& s, string& t) {
    string concat = s + "#" + t;

    vector<int> z(sz(concat));

    z_func(concat, z);

    for (int i = sz(s); i < sz(concat); ++i) {
        if (z[i] == sz(s)) return true;
    }

    return false;
}

void pop_back_str(string& s) {
    reverse(all(s));
    s.pop_back();
    reverse(all(s));
}

void solve() {
    cin >> s;

    dp.assign(n, 0);
    string global_pref = "";
    global_pref += s[0];
    dp[0] = a;

    for (int i = 1; i < n; ++i) {
        dp[i] = dp[i - 1] + a;
        global_pref += s[i];

        // for (int j = 0; j < i; ++j) {
        //     if (s[i] == s[j]) {
        //         dp[i] = min(dp[i], dp[j] + b);
        //         break;
        //     }
        // }

        reverse(all(global_pref));

        string pref = ""; pref += global_pref[0];
        string suff = global_pref; pop_back_str(suff);

        for (int j = 1; sz(pref) <= sz(suff); ++j) {
            if (is_substring(pref, suff)) {
                dp[i] = min(dp[i], dp[i - j] + b);
            }

            pref += global_pref[j];
            pop_back_str(suff);
        }

        reverse(all(global_pref));
    }

    // info(dp);

    cout << dp[n - 1] << endl;
}

signed main() {
    boot();

    while (cin >> n >> a >> b) solve();
}


#include <bits/stdc++.h>

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(a) (int)((a).size())
#define sqr(a) (a) * (a)
#define endl '\n'
#define DBG(a) cout << #a << " := " << a << endl

typedef long long LL;
typedef long double LD;

const int MAX = (int)(1e5) + 7;
const int MOD = (int)(1e9) + 7;
const int INF_I = (int)(1e9) + 7;
const LL INF_LL = (long long)(1e18) + 7;

using namespace std;

int n, a, b;
string s;
vector<int> dp;

template <typename T> void info(T& a) {
    for (auto &el: a) cout << el << ' ';
    cout << endl;
}

inline int input_I() {
    int a;
    cin >> a;
    return a;
}

inline long long input_LL() {
    long long a;
    cin >> a;
    return a;
}

void boot() {
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
}

void z_func_rev(string s, vector<int>& z) {
    int n = sz(s);
    int l = 0, r = 0;
    fill(all(z), 0);

    for (int i = 1; i < n; ++i) {
        if (i <= r) z[i] = min(z[i - l], r - i + 1);

        while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];

        if (i + z[i] - 1 > r) {
            l = i;
            r = i + z[i] - 1;
        }
    }

    for (int i = 1; i < n; ++i) {
        z[i] = min(z[i], i);
    }

    // cout << "z:"; info(z);

    reverse(all(z));
}

void solve() {
    cin >> s;

    int n = sz(s);
    string cur = ""; cur += s[0];
    dp.assign(n, 0);

    dp[0] = a;

    for (int i = 1; i < n; ++i) {
        dp[i] = dp[i - 1] + a;
        cur += s[i];

        for (int j = i - 1; j >= 0; --j) {
            if (s[i] == s[j]) {
                dp[i] = min(dp[i], dp[i - 1] + b);
            }
        }

        vector<int> z(i + 1);

        reverse(all(cur));
        z_func_rev(cur, z);
        reverse(all(cur));

        // info(z);

        for (int j = i - 1; j >= 0; --j) {
            if (z[j] == i - j) {
                dp[i] = min(dp[i], dp[j] + b);
            }
        }
    }

    cout << dp[n - 1] << endl;
}

signed main() {
    boot();

    while (cin >> n >> a >> b) solve();
}


#include <bits/stdc++.h>

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(a) (int)((a).size())
#define sqr(a) (a) * (a)
#define endl '\n'
#define DBG(a) cout << #a << " := " << a << endl

typedef long long LL;
typedef long double LD;

const int MAX = (int)(1e5) + 7;
const int MOD = (int)(1e9) + 7;
const int INF_I = (int)(1e9) + 7;
const LL INF_LL = (long long)(1e18) + 7;

using namespace std;

int n, a, b;
string s;
vector<int> dp;

template <typename T> void info(T& a) {
    for (auto &el: a) cout << el << ' ';
    cout << endl;
}

inline int input_I() {
    int a;
    cin >> a;
    return a;
}

inline long long input_LL() {
    long long a;
    cin >> a;
    return a;
}

void boot() {
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
}

void z_func_rev(string& s, vector<int>& z) {
    int n = sz(s);
    int l = 0, r = 0;
    z.assign(n, 0);

    for (int i = 1; i < n; ++i) {
        if (l <= r) z[i] = min(z[i - l], r - i + 1);

        while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];

        if (i + z[i] - 1 > r) {
            l = i;
            r = i + z[i] - 1;
        }
    }

    reverse(all(z));

    for (int i = n - 1; i >= 0; --i) {
        z[i] = min(z[i], n - i);
    }
}

void solve() {
    cin >> s;

    int n = sz(s);
    string cur = ""; cur += s[0];
    dp.assign(n, 0);

    dp[0] = a;

    for (int i = 1; i < n; ++i) {
        dp[i] = dp[i - 1] + a;
        cur += s[i];

        for (int j = i - 1; j >= 0; --j) {
            if (s[i] == s[j]) {
                dp[i] = min(dp[i], dp[i - 1] + b);
            }
        }

        vector<int> z(i);

        z_func_rev(cur, z);

        for (int j = i - 1; j >= 0; --j) {
            if (z[j] == i - j) {
                dp[i] = min(dp[i], dp[j] + b);
            }
        }
    }

    cout << dp[n - 1] << endl;
}

signed main() {
    boot();

    while (cin >> n >> a >> b) solve();
}


#include <bits/stdc++.h>

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(a) (int)((a).size())
#define sqr(a) (a) * (a)
#define endl '\n'
#define DBG(a) cout << #a << " := " << a << endl

typedef long long LL;
typedef long double LD;

const int MAX = (int)(1e5) + 7;
const int MOD = (int)(1e9) + 7;
const int INF_I = (int)(1e9) + 7;
const LL INF_LL = (long long)(1e18) + 7;

using namespace std;

int n, a, b;
string s;
vector<int> dp;

template <typename T> void info(T& a) {
    for (auto &el: a) cout << el << ' ';
    cout << endl;
}

inline int input_I() {
    int a;
    cin >> a;
    return a;
}

inline long long input_LL() {
    long long a;
    cin >> a;
    return a;
}

void boot() {
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
}

void z_func_rev(string s, vector<int>& z) {
    int n = sz(s);
    int l = 0, r = 0;
    fill(all(z), 0);

    for (int i = 1; i < n; ++i) {
        if (i <= r) z[i] = min(z[i - l], r - i + 1);

        while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];

        if (i + z[i] - 1 > r) {
            l = i;
            r = i + z[i] - 1;
        }
    }

    // for (int i = 1; i < n; ++i) {
    //     z[i] = min(z[i], i);
    // }

    // cout << "z:"; info(z);

    // reverse(all(z));
}

void solve() {
    // cout << "------------------\n";
    cin >> s;

    int n = sz(s);
    string cur = ""; cur += s[0];
    dp.assign(n, 0);

    dp[0] = a;

    for (int i = 1; i < n; ++i) {
        dp[i] = dp[i - 1] + a;
        cur += s[i];

        for (int j = 0; j < i; ++j) {
            if (s[j] == s[i]) {
                dp[i] = min(dp[i], dp[i - 1] + b);
                break;
            }
        }

        reverse(all(cur));

        vector<int> z(sz(cur));

        z_func_rev(cur, z);

        // info(z);

        for (int j = 1; j < i; ++j) {
            bool flag = false;
            for (int k = j; k < i; ++k) {
                if (z[k] >= j) {
                    flag = true;
                    break;
                }
            }

            if (flag) {
                dp[i] = min(dp[i], dp[i - j] + b);
            }
        }
    }

    cout << dp[n - 1] << endl;
}

signed main() {
    boot();

    while (cin >> n >> a >> b) solve();
}


#include <bits/stdc++.h>

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(a) (int)((a).size())
#define sqr(a) (a) * (a)
#define endl '\n'
#define DBG(a) cout << #a << " := " << a << endl

typedef long long LL;
typedef long double LD;

const int MAX = (int)(1e5) + 7;
const int MOD = (int)(1e9) + 7;
const int INF_I = (int)(1e9) + 7;
const LL INF_LL = (long long)(1e18) + 7;

using namespace std;

int n, a, b;
string s;
vector<int> dp;

template <typename T> void info(T& a) {
    for (auto &el: a) cout << el << ' ';
    cout << endl;
}

inline int input_I() {
    int a;
    cin >> a;
    return a;
}

inline long long input_LL() {
    long long a;
    cin >> a;
    return a;
}

void boot() {
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
}

void z_func_rev(string s, vector<int>& z) {
    int n = sz(s);
    int l = 0, r = 0;
    fill(all(z), 0);

    for (int i = 1; i < n; ++i) {
        if (i <= r) z[i] = min(z[i - l], r - i + 1);

        while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];

        if (i + z[i] - 1 > r) {
            l = i;
            r = i + z[i] - 1;
        }
    }

    // for (int i = 1; i < n; ++i) {
    //     z[i] = min(z[i], i);
    // }

    // cout << "z:"; info(z);

    // reverse(all(z));
}

void solve() {
    // cout << "------------------\n";
    cin >> s;

    int n = sz(s);
    string cur = ""; cur += s[0];
    dp.assign(n, 0);

    dp[0] = a;

    for (int i = 1; i < n; ++i) {
        dp[i] = dp[i - 1] + a;
        cur += s[i];

        for (int j = 0; j < i; ++j) {
            if (s[j] == s[i]) {
                dp[i] = min(dp[i], dp[i - 1] + b);
                break;
            }
        }

        reverse(all(cur));

        vector<int> z(sz(cur));

        z_func_rev(cur, z);

        // info(z);

        for (int j = 1; j < i; ++j) {
            bool flag = false;
            for (int k = 1; k < i; ++k) {
                if (z[k] >= j) {
                    flag = true;
                    break;
                }
            }

            if (flag) {
                dp[i] = min(dp[i], dp[i - j] + b);
            }
        }
    }

    cout << dp[n - 1] << endl;
}

signed main() {
    boot();

    while (cin >> n >> a >> b) solve();
}


#include <bits/stdc++.h>

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(a) (int)((a).size())
#define sqr(a) (a) * (a)
#define endl '\n'
#define DBG(a) cout << #a << " := " << a << endl

typedef long long LL;
typedef long double LD;

const int MAX = (int)(1e5) + 7;
const int MOD = (int)(1e9) + 7;
const int INF_I = (int)(1e9) + 7;
const LL INF_LL = (long long)(1e18) + 7;

using namespace std;

int n, a, b;
string s;
vector<int> dp;

template <typename T> void info(T& a) {
    for (auto &el: a) cout << el << ' ';
    cout << endl;
}

inline int input_I() {
    int a;
    cin >> a;
    return a;
}

inline long long input_LL() {
    long long a;
    cin >> a;
    return a;
}

void boot() {
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
}

void z_func(string& s, vector<int>& z) {
    int n = sz(s);
    int l = 0, r = 0;
    fill(all(z), 0);

    for (int i = 1; i < n; ++i) {
        if (i <= r) z[i] = min(z[i - l], r - i + 1);

        while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];

        if (i + z[i] - 1 > r) {
            l = i;
            r = i + z[i] - 1;
        }
    }
}

bool is_substring(string& s, string& t) {
    string concat = s + t;

    vector<int> z(sz(concat));

    z_func(concat, z);

    for (int i = sz(s); i < sz(concat); ++i) {
        if (z[i] >= sz(s)) return true;
    }

    return false;
}

void pop_back_str(string& s) {
    reverse(all(s));
    s.pop_back();
    reverse(all(s));
}

void solve() {
    cin >> s;

    dp.assign(n, 0);
    string global_pref = "";
    global_pref += s[0];
    dp[0] = a;

    for (int i = 1; i < n; ++i) {
        dp[i] = dp[i - 1] + a;
        global_pref += s[i];

        for (int j = 0; j < i; ++j) {
            if (s[i] == s[j]) {
                dp[i] = min(dp[i], dp[i - 1] + b);
                break;
            }
        }

        reverse(all(global_pref));

        vector<int> z(sz(global_pref));

        z_func(global_pref, z);

        // info(z);

        int pref_ln = 1;
        int suff_ln = i;

        for (int ln = 1; pref_ln <= suff_ln; ++ln, ++pref_ln, --suff_ln) {
            // cout << pref_ln << ' ' << suff_ln << endl;
            for (int j = ln; j < i; ++j) {
                if (z[j] >= ln) {
                    dp[i] = min(dp[i], dp[i - ln] + b);
                }
            }
        }

        reverse(all(global_pref));
    }

    // info(dp);

    cout << dp[n - 1] << endl;
}

signed main() {
    boot();

    while (cin >> n >> a >> b) solve();
}


#include <bits/stdc++.h>

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(a) (int)((a).size())
#define sqr(a) (a) * (a)
#define endl '\n'
#define DBG(a) cout << #a << " := " << a << endl

typedef long long LL;
typedef long double LD;

const int MAX = (int)(1e5) + 7;
const int MOD = (int)(1e9) + 7;
const int INF_I = (int)(1e9) + 7;
const LL INF_LL = (long long)(1e18) + 7;

using namespace std;

int n, a, b;
string s;
vector<int> dp;

template <typename T> void info(T& a) {
    for (auto &el: a) cout << el << ' ';
    cout << endl;
}

inline int input_I() {
    int a;
    cin >> a;
    return a;
}

inline long long input_LL() {
    long long a;
    cin >> a;
    return a;
}

void boot() {
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
}

void z_func(string& s, vector<int>& z) {
    int n = sz(s);
    int l = 0, r = 0;
    fill(all(z), 0);

    for (int i = 1; i < n; ++i) {
        if (i <= r) z[i] = min(z[i - l], r - i + 1);

        while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];

        if (i + z[i] - 1 > r) {
            l = i;
            r = i + z[i] - 1;
        }
    }
}

bool is_substring(string& s, string& t) {
    string concat = s + t;

    vector<int> z(sz(concat));

    z_func(concat, z);

    for (int i = sz(s); i < sz(concat); ++i) {
        if (z[i] >= sz(s)) return true;
    }

    return false;
}

void pop_back_str(string& s) {
    reverse(all(s));
    s.pop_back();
    reverse(all(s));
}

void solve() {
    cin >> s;

    dp.assign(n, 0);
    string global_pref = "";
    global_pref += s[0];
    dp[0] = a;

    for (int i = 1; i < n; ++i) {
        dp[i] = dp[i - 1] + a;
        global_pref += s[i];

        // for (int j = 0; j < i; ++j) {
        //     if (s[i] == s[j]) {
        //         dp[i] = min(dp[i], dp[j] + b);
        //         break;
        //     }
        // }

        reverse(all(global_pref));

        string pref = ""; pref += global_pref[0];
        string suff = global_pref; pop_back_str(suff);

        for (int j = 1; sz(pref) <= sz(suff); ++j) {
            if (is_substring(pref, suff)) {
                dp[i] = min(dp[i], dp[i - j] + b);
            }

            pref += global_pref[j];
            pop_back_str(suff);
        }

        reverse(all(global_pref));
    }

    // info(dp);

    cout << dp[n - 1] << endl;
}

signed main() {
    boot();

    while (cin >> n >> a >> b) solve();
}


#include <bits/stdc++.h>

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(a) (int)((a).size())
#define sqr(a) (a) * (a)
#define endl '\n'
#define DBG(a) cout << #a << " := " << a << endl

typedef long long LL;
typedef long double LD;

const int MAX = (int)(1e5) + 7;
const int MOD = (int)(1e9) + 7;
const int INF_I = (int)(1e9) + 7;
const LL INF_LL = (long long)(1e18) + 7;

using namespace std;

int n, a, b;
string s;
vector<int> dp;

template <typename T> void info(T& a) {
    for (auto &el: a) cout << el << ' ';
    cout << endl;
}

inline int input_I() {
    int a;
    cin >> a;
    return a;
}

inline long long input_LL() {
    long long a;
    cin >> a;
    return a;
}

void boot() {
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
}

void z_func_rev(string s, vector<int>& z) {
    int n = sz(s);
    int l = 0, r = 0;
    fill(all(z), 0);

    for (int i = 1; i < n; ++i) {
        if (i <= r) z[i] = min(z[i - l], r - i + 1);

        while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];

        if (i + z[i] - 1 > r) {
            l = i;
            r = i + z[i] - 1;
        }
    }

    for (int i = 1; i < n; ++i) {
        z[i] = min(z[i], i);
    }

    // cout << "z:"; info(z);

    reverse(all(z));
}

void solve() {
    // cout << "------------------\n";
    cin >> s;

    int n = sz(s);
    string cur = ""; cur += s[0];
    dp.assign(n, 0);

    dp[0] = a;

    for (int i = 1; i < n; ++i) {
        dp[i] = dp[i - 1] + a;
        cur += s[i];

        for (int j = i - 1; j >= 0; --j) {
            if (s[i] == s[j]) {
                dp[i] = min(dp[i], dp[i - 1] + b);
            }
        }

        vector<int> z(i + 1);

        reverse(all(cur));
        z_func_rev(cur, z);
        reverse(all(cur));

        // info(z);

        for (int j = i - 1; j >= 0; --j) {
            if (z[j] == i - j) {
                for (int k = i - 1; k >= j; --k) dp[i] = min(dp[i], dp[k] + b);
            }
        }
    }

    cout << dp[n - 1] << endl;
}

signed main() {
    boot();

    while (cin >> n >> a >> b) solve();
}


#include <bits/stdc++.h>

#define vec vector
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define int long long
#define pb push_back
using namespace std;
typedef pair<long long, long long> PII;
string s;
vec < int > hah;
const int MOD = 1e12+39;
void kek(){
    hah.pb(s[0]-'a'+1LL);
    for(int i = 1; i < s.size(); ++i)
        hah.pb(hah[i-1]*47LL+signed(s[i]-'a')+1LL), hah[i] = (hah[i]+MOD)%MOD;
}
vec < int > p_m;
int rl, rr;
int get_hah(int l, int r){
    if(l == 0)
        return hah[r];
    return (hah[r]-(hah[l-1]*p_m[r-l+1])%MOD+MOD)%MOD;
}
signed main()
{
    int n, a, b;
    cin >> n >> a >> b;
    p_m.pb(1);
    for(int i = 1; i <= n + 20; ++i)
        p_m.pb(p_m[i-1]*47), p_m[i] = (p_m[i]+MOD)%MOD;
    cin >> s;
    kek();
    vec < int > dp(n);
    dp[0] = a;
    int ll, lr;
    for(int i = 1; i < n; ++i){
        dp[i] = dp[i-1]+a;
        int l_len = 1;
        int r_len = n;
        int ll = i, rr = i;
        while(l_len != r_len){
            bool fl = false;
            int t = (l_len+r_len)/2;
            for(int right = t-1; right <= rr-t; ++right){
                if(get_hah(right-t+1, right) == get_hah(rr-t+1, rr)){
                    dp[i] = min(dp[i], dp[rr-t]+b), fl = true;
                    break;
                }
            }
            if(fl)
                l_len = t+1;
            else
                r_len = t;
        }
    }
    cout << dp[n-1];
    return 0;
}


#include <bits/stdc++.h>

#define vec vector
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define int long long
#define pb push_back
using namespace std;
typedef pair<long long, long long> PII;
string s;
vec < int > hah;
const int MOD = 1e12+39;
void kek(){
    hah.pb(s[0]-'a'+1LL);
    for(int i = 1; i < s.size(); ++i)
        hah.pb(hah[i-1]*31LL+signed(s[i]-'a')+1LL), hah[i] = (hah[i]+MOD)%MOD;
}
vec < int > p_m;
int rl, rr;
int get_hah(int l, int r){
    if(l == 0)
        return hah[r];
    return (hah[r]-hah[l-1]*p_m[r-l+1]+MOD)%MOD;
}
int dix(int l, int r){
    if(l == r)
        return l;
    int t = (l+r)/2;
    if(get_hah(t, rl) != get_hah(rr-(rl-t), rr))
        l = t+1;
    else
        r = t;
    return dix(l, r);
}
signed main()
{
    int n, a, b;
    cin >> n >> a >> b;
    p_m.pb(1);
    for(int i = 1; i <= n; ++i)
        p_m.pb(p_m[i-1]*31), p_m[i] = (p_m[i]+MOD)%MOD;
    cin >> s;
    kek();
    vec < int > dp(n);
    dp[0] = a;
//    for(int i = 0; i < n; ++i)
//        cout << hah[i] << " ";
//    cout << "\n";
    int ll, lr;
    for(int i = 1; i < n; ++i){
        int len = 1;
        rr = i;
        lr = i;
        int fak = 0;
        dp[i] = dp[i-1]+a;
        for(int j = 0; j < i; ++j){
            rl = j;
            ll = j;
            fak = dix(max(rl-(rr-rl-1), 0LL), rl);
            lr = rr-(rl-fak), ll = fak;
            int t = ll;
            if(get_hah(t, rl) == get_hah(rr-(rl-t), rr))
                dp[i] = min(dp[i], dp[lr-1]+b);//, cout << get_hah(t, rl) << " " << get_hah(rr-(rl-t), rr) << "\t" << t << " " << rl << "==" << rr-(rl-t) << " " << rr << "\n";
            /*else{
                for(int k = ll; k <= rl; ++k)
                    cout << s[k];
                cout << "!=";
                for(int k = lr; k <= rr; ++k)
                    cout << s[k];
                cout << "\n";
            }*/
        }
    }
//    for(int i = 0; i < n; ++i)
//        cout << dp[i] << " ";
//    cout << "\n";
    cout << dp[n-1];
    return 0;
}


#include <bits/stdc++.h>

#define vec vector
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define int long long
#define pb push_back
using namespace std;
typedef pair<long long, long long> PII;
string s;
vec < int > hah;
const int MOD = 1e9+3;
void kek(){
    hah.pb(s[0]-'a'+1LL);
    for(int i = 1; i < s.size(); ++i)
        hah.pb(hah[i-1]*31LL+signed(s[i]-'a')+1LL), hah[i] = (hah[i]+MOD)%MOD;
}
vec < int > p_m;
int rl, rr;
int get_hah(int l, int r){
    if(l == 0)
        return hah[r];
    return (hah[r]-(hah[l-1]*p_m[r-l+1])%MOD+MOD)%MOD;
}
signed main()
{
    int n, a, b;
    cin >> n >> a >> b;
    p_m.pb(1);
    for(int i = 1; i <= n + 20; ++i)
        p_m.pb(p_m[i-1]*31), p_m[i] = (p_m[i]+MOD)%MOD;
    cin >> s;
    kek();
    vec < int > dp(n);
    dp[0] = a;
    int ll, lr;
    for(int i = 1; i < n; ++i){
        dp[i] = dp[i-1]+a;
        int l_len = 1;
        int r_len = n;
        int ll = i, rr = i;
        while(l_len != r_len){
            bool fl = false;
            int t = (l_len+r_len)/2;
            for(int right = t-1; right <= rr-t; ++right){
                if(get_hah(right-t+1, right) == get_hah(rr-t+1, rr)){
                    dp[i] = min(dp[i], dp[rr-t]+b), fl = true;
                    break;
                }
            }
            if(fl)
                l_len = t+1;
            else
                r_len = t;
        }
    }
    cout << dp[n-1];
    return 0;
}


#include <bits/stdc++.h>

#define vec vector
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define int long long
#define pb push_back
using namespace std;
typedef pair<long long, long long> PII;
string s;
vec < int > hah;
const int MOD = 1e9+3;
void kek(){
    hah.pb(s[0]-'a'+1LL);
    for(int i = 1; i < s.size(); ++i)
        hah.pb(hah[i-1]*31LL+signed(s[i]-'a')+1LL), hah[i] = (hah[i]+MOD)%MOD;
}
vec < int > p_m;
int rl, rr;
int get_hah(int l, int r){
    if(l == 0)
        return hah[r];
    return (hah[r]-(hah[l-1]*p_m[r-l+1])%MOD+MOD)%MOD;
}
int dix(int l, int r){
    if(l == r)
        return l;
    int t = (l+r)/2;
    if(get_hah(t, rl) != get_hah(rr-(rl-t), rr))
        l = t+1;
    else
        r = t;
    return dix(l, r);
}
signed main()
{
    int n, a, b;
    cin >> n >> a >> b;
    p_m.pb(1);
    for(int i = 1; i <= n + 20; ++i)
        p_m.pb(p_m[i-1]*31), p_m[i] = (p_m[i]+MOD)%MOD;
    cin >> s;
    kek();
    vec < int > dp(n);
    dp[0] = a;
//    for(int i = 0; i < n; ++i)
//        cout << hah[i] << " ";
//    cout << "\n";
    int ll, lr;
    for(int i = 1; i < n; ++i){
        int len = 1;
        rr = i;
        lr = i;
        int fak = 0;
        dp[i] = dp[i-1]+a;
        for(int j = 0; j < i; ++j){
            rl = j;
            ll = j;
            fak = dix(max(rl-(rr-rl-1), 0LL), rl);
            lr = rr-(rl-fak), ll = fak;
            int t = ll;
            if(get_hah(t, rl) == get_hah(rr-(rl-t), rr))
                dp[i] = min(dp[i], dp[lr-1]+b);//, cout << get_hah(t, rl) << " " << get_hah(rr-(rl-t), rr) << "\t" << t << " " << rl << "==" << rr-(rl-t) << " " << rr << "\n";
        }
    }
//    for(int i = 0; i < n; ++i)
//        cout << dp[i] << " ";
//    cout << "\n";
    cout << dp[n-1];
    return 0;
}


#include <bits/stdc++.h>

#define vec vector
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define int long long
#define pb push_back
using namespace std;
typedef pair<long long, long long> PII;
string s;
vec < int > hah;
const int MOD = 1e9+3;
void kek(){
    hah.pb(s[0]-'a'+1LL);
    for(int i = 1; i < s.size(); ++i)
        hah.pb(hah[i-1]*47LL+signed(s[i]-'a')+1LL), hah[i] = (hah[i]+MOD)%MOD;
}
vec < int > p_m;
int rl, rr;
int get_hah(int l, int r){
    if(l == 0)
        return hah[r];
    return (hah[r]-(hah[l-1]*p_m[r-l+1])%MOD+MOD)%MOD;
}
signed main()
{
    int n, a, b;
    cin >> n >> a >> b;
    p_m.pb(1);
    for(int i = 1; i <= n + 20; ++i)
        p_m.pb(p_m[i-1]*47), p_m[i] = (p_m[i]+MOD)%MOD;
    cin >> s;
    kek();
    vec < int > dp(n);
    dp[0] = a;
    int ll, lr;
    for(int i = 1; i < n; ++i){
        dp[i] = dp[i-1]+a;
        int l_len = 1;
        int r_len = n;
        int ll = i, rr = i;
        while(l_len != r_len){
            bool fl = false;
            int t = (l_len+r_len)/2;
            for(int right = t-1; right <= rr-t; ++right){
                if(get_hah(right-t+1, right) == get_hah(rr-t+1, rr)){
                    dp[i] = min(dp[i], dp[rr-t]+b), fl = true;
                    break;
                }
            }
            if(fl)
                l_len = t+1;
            else
                r_len = t;
        }
    }
    cout << dp[n-1];
    return 0;
}


#include <bits/stdc++.h>

#define vec vector
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define int long long
#define pb push_back
using namespace std;
typedef pair<long long, long long> PII;
string s;
vec < int > hah;
const int MOD = 1e12+39;
void kek(){
    hah.pb(s[0]-'a'+1LL);
    for(int i = 1; i < s.size(); ++i)
        hah.pb(hah[i-1]*31LL+signed(s[i]-'a')+1LL), hah[i] = (hah[i]+MOD)%MOD;
}
vec < int > p_m;
int rl, rr;
int get_hah(int r, int l){
    return (hah[r]-hah[l]+s[l]-'a'+MOD)%MOD;
}
int dix(int l, int r){
    if(l == r)
        return l;
    int t = (l+r)/2;
    if((get_hah(t, rl)*p_m[rr-rl]+MOD)%MOD != get_hah(rr-(rl-t), rr))
        l = t+1;
    else
        r = t;
    return dix(l, r);
}
signed main()
{
    int n, a, b;
    cin >> n >> a >> b;
    p_m.pb(1);
    for(int i = 1; i <= n; ++i)
        p_m.pb(p_m[i-1]*31), p_m[i] = (p_m[i]+MOD)%MOD;
    cin >> s;
    kek();
    vec < int > dp(n);
    dp[0] = a;
    int ll, lr;
//    cout << get_hah(0, 0) << " " << get_hah(1, 1);
//    cout << (get_hah(0, 1)*p_m[3-1])%MOD << " " << get_hah(2, 3);
//    return 0;
    for(int i = 1; i < n; ++i){
        int len = 1;
        rr = i;
        lr = i;
        int fak = 0;
        dp[i] = dp[i-1]+a;
        for(int j = 0; j < i; ++j){
            rl = j;
            ll = j;
//            cout << "\t" << max(rl-(rr-rl-1), 0LL) << " " << rl << "\n";
            fak = dix(max(rl-(rr-rl-1), 0LL), rl);
//            cout << "\t" << dix(max(rl-(rr-rl-1), 0LL), rl) << "\n";
            if(rl-fak > rr-lr)
                lr = rr-(rl-fak), ll = fak;//, cout << lr << " " << rr << " " << dp[lr-1] << " ";
            if((get_hah(ll, rl)*p_m[rr-rl]+MOD)%MOD == get_hah(lr, rr))
                dp[i] = min(dp[i], dp[lr-1]+b);

        }
    }
    cout << dp[n-1];
    return 0;
}


#include <bits/stdc++.h>

#define vec vector
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define int long long
#define pb push_back
using namespace std;
typedef pair<long long, long long> PII;
string s;
vec < int > hah;
const int MOD = 1e9+3;
void kek(){
    hah.pb(s[0]-'a'+1LL);
    for(int i = 1; i < s.size(); ++i)
        hah.pb(hah[i-1]*31LL+signed(s[i]-'a')+1LL), hah[i] = (hah[i]+MOD)%MOD;
}
vec < int > p_m;
int rl, rr;
int get_hah(int l, int r){
    if(l == 0)
        return hah[r];
    return (hah[r]-(hah[l-1]*p_m[r-l+1])%MOD+MOD)%MOD;
}
signed main()
{
    int n, a, b;
    cin >> n >> a >> b;
    p_m.pb(1);
    for(int i = 1; i <= n + 20; ++i)
        p_m.pb(p_m[i-1]*31), p_m[i] = (p_m[i]+MOD)%MOD;
    cin >> s;
    kek();
    vec < int > dp(n);
    dp[0] = a;
    int ll, lr;
    for(int i = 1; i < n; ++i){
        dp[i] = dp[i-1]+a;
        int l_len = 1;
        int r_len = n;
        int ll = i, rr = i;
        while(l_len != r_len){
            bool fl = false;
            int t = (l_len+r_len)/2;
            for(int right = t-1; right <= rr-t; ++right){
                if(get_hah(right-t+1, right) == get_hah(rr-t+1, rr))
                    dp[i] = min(dp[i], dp[rr-t]+b), fl = true;
            }
            if(fl)
                l_len = t+1;
            else
                r_len = t;
        }
    }
    cout << dp[n-1];
    return 0;
}


#include<iostream>
#include<string>
#include<set>
#include<map>
#include<algorithm>

using namespace std;

const int MAXN = 5005;
const long long key1 = 29, key2 = 31;
const long long mod1 = 1e9 + 7, mod2 = 1e9 + 9;

int n;
int a, b;
string s;

int dp[MAXN];
long long p1[MAXN], p2[MAXN];
pair <long long, long long> h[MAXN];

int length = 0;
pair < pair <int, int>, int > arr[MAXN*MAXN/2+MAXN];

bool checkIn(pair <int, int> x)
{
    int l, r, mid;

    l = 0;
    r = length - 1;
    while(l+1<r)
    {
        mid = (l+r)/2;

        if(arr[mid].first<=x) l = mid;
        else r = mid - 1;
    }

    if(arr[l].first==x) return true;
    if(arr[r].first==x) return true;
    return false;
}

int value(pair <int, int> x)
{
    int l, r, mid;

    l = 0;
    r = length - 1;
    while(l+1<r)
    {
        mid = (l+r)/2;

        if(arr[mid].first<x) l = mid;
        else if(arr[mid].first==x) r = mid;
        else r = mid - 1;
    }

    if(arr[l].first==x) return arr[l].second;
    if(arr[r].first==x) return arr[r].second;
}

void Init()
{
    h[0] = {s[0]-'a'+1, s[0]-'a'+1};
    for(int i = 1;i<n;i++)
    {
        h[i].first = (h[i-1].first*key1 + (s[i]-'a'+1))%mod1;
        h[i].second = (h[i-1].second*key2 + (s[i]-'a'+1))%mod2;
    }

    p1[0] = 1;
    p2[0] = 1;
    for(int i = 1;i<=n;i++)
    {
        p1[i] = (p1[i-1]*key1)%mod1;
        p2[i] = (p2[i-1]*key2)%mod2;
    }
}

pair <long long, long long> getHash(int l, int r)
{
    pair <long long, long long> output;
    output = h[r];

    if(l!=0)
    {
        output.first = (output.first - (h[l-1].first*p1[r-l+1])%mod1 + mod1)%mod1;
        output.second = (output.second - (h[l-1].second*p2[r-l+1])%mod2 + mod2)%mod2;
    }

    return output;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int l, r, mid;

    cin >> n >> a >> b;
    cin >> s;
    Init();

    for(int i = n-1;i>=0;i--)
    {
        for(int len = 1;len<=n/2+1;len++)
        {
            if(i+len-1>=n) break;

            arr[length] = {getHash(i, i+len-1), i+len-1};
            length++;

            //cout << "add: " << getHash(i, i+len-1).first << " " << getHash(i, i+len-1).second << '\n';
        }
    }
    sort(arr, arr+length);

    dp[0] = a;
    for(int i = 1;i<n;i++)
    {
        dp[i] = dp[i-1] + a;
        if(value(getHash(i, i))<i)
        {
            //cout << i << "\n";

            //cout << "request: " << getHash(1, i).first << " " << getHash(1, i).second << '\n';
            //cout << checkIn(getHash(1, i)) << " " << value(getHash(1, i)) << '\n';

            l = 1;
            r = i;
            while(l+1<r)
            {
                mid = (l+r)/2;

                if(checkIn(getHash(mid, i))==true && value(getHash(mid, i))<mid) r = mid;
                else l = mid + 1;
            }

            if(checkIn(getHash(l, i))==true && value(getHash(l, i))<l) dp[i] = min(dp[l-1]+b, dp[i]);
            if(checkIn(getHash(r, i))==true && value(getHash(r, i))<r) dp[i] = min(dp[r-1]+b, dp[i]);
        }
    }

    cout << dp[n-1] << '\n';
}


#include<iostream>
#include<string>
#include<set>
#include<map>

using namespace std;

const int MAXN = 5005;
const long long key1 = 29, key2 = 31;
const long long mod1 = 1e9 + 7, mod2 = 1e9 + 9;

int n;
int a, b;
string s;

int dp[MAXN];
long long p1[MAXN], p2[MAXN];
pair <long long, long long> h[MAXN];
map < pair <long long, long long>, int > mp;

void Init()
{
    h[0] = {s[0]-'a'+1, s[0]-'a'+1};
    for(int i = 1;i<n;i++)
    {
        h[i].first = (h[i-1].first*key1 + (s[i]-'a'+1))%mod1;
        h[i].second = (h[i-1].second*key2 + (s[i]-'a'+1))%mod2;
    }

    p1[0] = 1;
    p2[0] = 1;
    for(int i = 1;i<=n;i++)
    {
        p1[i] = (p1[i-1]*key1)%mod1;
        p2[i] = (p2[i-1]*key2)%mod2;
    }
}

pair <long long, long long> getHash(int l, int r)
{
    pair <long long, long long> output;
    output = h[r];

    if(l!=0)
    {
        output.first = (output.first - (h[l-1].first*p1[r-l+1])%mod1 + mod1)%mod1;
        output.second = (output.second - (h[l-1].second*p2[r-l+1])%mod2 + mod2)%mod2;
    }

    return output;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> a >> b;
    cin >> s;
    Init();

    for(int i = 0;i<n;i++)
    {
        for(int j = 0;j<=i;j++)
        {
            if(mp.count(getHash(j, i))==false)
            {
                mp[getHash(j, i)] = i;
            }
        }
    }

    dp[0] = a;
    for(int i = 1;i<n;i++)
    {
        dp[i] = dp[i-1] + a;
        for(int j = i;j>=1;j--)
        {
            if(mp[getHash(j, i)]>=j) continue;
            dp[i] = min(dp[j-1] + b, dp[i]);
        }
    }

    cout << dp[n-1] << '\n';
}


#include<iostream>
#include<string>
#include<set>
#include<map>

using namespace std;

const int MAXN = 5005;
const long long key1 = 29, key2 = 31;
const long long mod1 = 1e9 + 7, mod2 = 1e9 + 9;

int n;
int a, b;
string s;

int dp[MAXN];
long long p1[MAXN], p2[MAXN];
pair <long long, long long> h[MAXN];
map < pair <long long, long long>, int > mp;

void Init()
{
    h[0] = {s[0]-'a'+1, s[0]-'a'+1};
    for(int i = 1;i<n;i++)
    {
        h[i].first = (h[i-1].first*key1 + (s[i]-'a'+1))%mod1;
        h[i].second = (h[i-1].second*key2 + (s[i]-'a'+1))%mod2;
    }

    p1[0] = 1;
    p2[0] = 1;
    for(int i = 1;i<=n;i++)
    {
        p1[i] = (p1[i-1]*key1)%mod1;
        p2[i] = (p2[i-1]*key2)%mod2;
    }
}

pair <long long, long long> getHash(int l, int r)
{
    pair <long long, long long> output;
    output = h[r];

    if(l!=0)
    {
        output.first = (output.first - (h[l-1].first*p1[r-l+1])%mod1 + mod1)%mod1;
        output.second = (output.second - (h[l-1].second*p2[r-l+1])%mod2 + mod2)%mod2;
    }

    return output;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int l, r, mid;

    cin >> n >> a >> b;
    cin >> s;
    Init();

    for(int i = n-1;i>=0;i--)
    {
        for(int j = max(i/2-1, 0);j<=i;j++)
        {
            mp[getHash(j, i)] = i;
        }
    }

    dp[0] = a;
    for(int i = 1;i<n;i++)
    {
        dp[i] = dp[i-1] + a;
        if(mp[getHash(i, i)]<i)
        {
            l = 1;
            r = i;
            while(l+1<r)
            {
                mid = (l+r)/2;

                if(mp.count(getHash(mid, i))==true && mp[getHash(mid, i)]<mid) r = mid;
                else l = mid + 1;
            }

            if(mp.count(getHash(l, i))==true && mp[getHash(l, i)]<l) dp[i] = min(dp[l-1]+b, dp[i]);
            if(mp.count(getHash(r, i))==true && mp[getHash(r, i)]<r) dp[i] = min(dp[r-1]+b, dp[i]);
        }
    }

    cout << dp[n-1] << '\n';
}


#include<iostream>
#include<string>
#include<set>
#include<map>

using namespace std;

const int MAXN = 5005;
const long long key1 = 29, key2 = 31;
const long long mod1 = 1e9 + 7, mod2 = 1e9 + 9;

int n;
int a, b;
string s;

int dp[MAXN];
long long p1[MAXN], p2[MAXN];
pair <long long, long long> h[MAXN];
map < pair <long long, long long>, int > mp;

void Init()
{
    h[0] = {s[0]-'a'+1, s[0]-'a'+1};
    for(int i = 1;i<n;i++)
    {
        h[i].first = (h[i-1].first*key1 + (s[i]-'a'+1))%mod1;
        h[i].second = (h[i-1].second*key2 + (s[i]-'a'+1))%mod2;
    }

    p1[0] = 1;
    p2[0] = 1;
    for(int i = 1;i<=n;i++)
    {
        p1[i] = (p1[i-1]*key1)%mod1;
        p2[i] = (p2[i-1]*key2)%mod2;
    }
}

pair <long long, long long> getHash(int l, int r)
{
    pair <long long, long long> output;
    output = h[r];

    if(l!=0)
    {
        output.first = (output.first - (h[l-1].first*p1[r-l+1])%mod1 + mod1)%mod1;
        output.second = (output.second - (h[l-1].second*p2[r-l+1])%mod2 + mod2)%mod2;
    }

    return output;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int l, r, mid;

    cin >> n >> a >> b;
    cin >> s;
    Init();

    for(int i = n-1;i>=0;i--)
    {
        for(int j = 0;j<=i;j++)
        {
            mp[getHash(j, i)] = i;
        }
    }

    dp[0] = a;
    for(int i = 1;i<n;i++)
    {
        dp[i] = dp[i-1] + a;
        if(mp[getHash(i, i)]<i)
        {
            l = 1;
            r = i;
            while(l+1<r)
            {
                mid = (l+r)/2;

                if(mp[getHash(mid, i)]<mid) r = mid;
                else l = mid + 1;
            }

            if(mp[getHash(l, i)]<l) dp[i] = min(dp[l-1]+b, dp[i]);
            if(mp[getHash(r, i)]<r) dp[i] = min(dp[r-1]+b, dp[i]);
        }
    }

    cout << dp[n-1] << '\n';
}


#include<iostream>
#include<string>
#include<set>
#include<map>

using namespace std;

const int MAXN = 5005;
const long long key1 = 29, key2 = 31;
const long long mod1 = 1e9 + 7, mod2 = 1e9 + 9;

int n;
int a, b;
string s;

int dp[MAXN];
long long p1[MAXN], p2[MAXN];
pair <long long, long long> h[MAXN];
map < pair <long long, long long>, int > mp;

void Init()
{
    h[0] = {s[0]-'a'+1, s[0]-'a'+1};
    for(int i = 1;i<n;i++)
    {
        h[i].first = (h[i-1].first*key1 + (s[i]-'a'+1))%mod1;
        h[i].second = (h[i-1].second*key2 + (s[i]-'a'+1))%mod2;
    }

    p1[0] = 1;
    p2[0] = 1;
    for(int i = 1;i<=n;i++)
    {
        p1[i] = (p1[i-1]*key1)%mod1;
        p2[i] = (p2[i-1]*key2)%mod2;
    }
}

pair <long long, long long> getHash(int l, int r)
{
    pair <long long, long long> output;
    output = h[r];

    if(l!=0)
    {
        output.first = (output.first - (h[l-1].first*p1[r-l+1])%mod1 + mod1)%mod1;
        output.second = (output.second - (h[l-1].second*p2[r-l+1])%mod2 + mod2)%mod2;
    }

    return output;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> a >> b;
    cin >> s;
    Init();

    for(int i = 0;i<n;i++)
    {
        for(int j = 0;j<=i;j++)
        {
            if(mp.count(getHash(j, i))==false)
            {
                mp[getHash(j, i)] = i;
            }
        }
    }

    dp[0] = a;
    for(int i = 1;i<n;i++)
    {
        dp[i] = dp[i-1] + a;
        for(int j = i;j>=1;j--)
        {
            if(mp[getHash(j, i)]>=j) break;
            dp[i] = min(dp[j-1] + b, dp[i]);
        }
    }

    cout << dp[n-1] << '\n';
}


#include<iostream>
#include<string>
#include<set>
#include<map>

using namespace std;

const int MAXN = 5005;
const long long key1 = 29, key2 = 31;
const long long mod1 = 1e9 + 7, mod2 = 1e9 + 9;

int n;
int a, b;
string s;

int dp[MAXN];
long long p1[MAXN], p2[MAXN];
pair <long long, long long> h[MAXN];
map < pair <long long, long long>, int > mp;

void Init()
{
    h[0] = {s[0]-'a'+1, s[0]-'a'+1};
    for(int i = 1;i<n;i++)
    {
        h[i].first = (h[i-1].first*key1 + (s[i]-'a'+1))%mod1;
        h[i].second = (h[i-1].second*key2 + (s[i]-'a'+1))%mod2;
    }

    p1[0] = 1;
    p2[0] = 1;
    for(int i = 1;i<=n;i++)
    {
        p1[i] = (p1[i-1]*key1)%mod1;
        p2[i] = (p2[i-1]*key2)%mod2;
    }
}

pair <long long, long long> getHash(int l, int r)
{
    pair <long long, long long> output;
    output = h[r];

    if(l!=0)
    {
        output.first = (output.first - (h[l-1].first*p1[r-l+1])%mod1 + mod1)%mod1;
        output.second = (output.second - (h[l-1].second*p2[r-l+1])%mod2 + mod2)%mod2;
    }

    return output;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int l, r, mid;

    cin >> n >> a >> b;
    cin >> s;
    Init();

    for(int i = 0;i<n;i++)
    {
        for(int j = 0;j<=i;j++)
        {
            if(mp.count(getHash(j, i))==false)
            {
                mp[getHash(j, i)] = i;
            }
        }
    }

    dp[0] = a;
    for(int i = 1;i<n;i++)
    {
        dp[i] = dp[i-1] + a;
        if(mp[getHash(i, i)]<i)
        {
            l = 1;
            r = i;
            while(l+1<r)
            {
                mid = (l+r)/2;

                if(mp[getHash(mid, i)]<mid) r = mid;
                else l = mid + 1;
            }

            if(mp[getHash(l, i)]<l) dp[i] = min(dp[l-1]+b, dp[i]);
            if(mp[getHash(r, i)]<r) dp[i] = min(dp[r-1]+b, dp[i]);
        }
    }

    cout << dp[n-1] << '\n';
}


#include<iostream>
#include<string>
#include<set>
#include<map>
#include<algorithm>

using namespace std;

const int MAXN = 5005;
const long long key1 = 29, key2 = 31;
const long long mod1 = 1e9 + 7, mod2 = 1e9 + 9;

int n;
int a, b;
string s;

int dp[MAXN];
long long p1[MAXN], p2[MAXN];
pair <long long, long long> h[MAXN];

int length = 0;
pair < pair <int, int>, int > arr[MAXN*MAXN/4+MAXN];

bool checkIn(pair <int, int> x)
{
    int l, r, mid;

    l = 0;
    r = length - 1;
    while(l+1<r)
    {
        mid = (l+r)/2;

        if(arr[mid].first<=x) l = mid;
        else r = mid - 1;
    }

    if(arr[l].first==x) return true;
    if(arr[r].first==x) return true;
    return false;
}

int value(pair <int, int> x)
{
    int l, r, mid;

    l = 0;
    r = length - 1;
    while(l+1<r)
    {
        mid = (l+r)/2;

        if(arr[mid].first<x) l = mid;
        else if(arr[mid].first==x) r = mid;
        else r = mid - 1;
    }

    if(arr[l].first==x) return arr[l].second;
    if(arr[r].first==x) return arr[r].second;
}

void Init()
{
    h[0] = {s[0]-'a'+1, s[0]-'a'+1};
    for(int i = 1;i<n;i++)
    {
        h[i].first = (h[i-1].first*key1 + (s[i]-'a'+1))%mod1;
        h[i].second = (h[i-1].second*key2 + (s[i]-'a'+1))%mod2;
    }

    p1[0] = 1;
    p2[0] = 1;
    for(int i = 1;i<=n;i++)
    {
        p1[i] = (p1[i-1]*key1)%mod1;
        p2[i] = (p2[i-1]*key2)%mod2;
    }
}

pair <long long, long long> getHash(int l, int r)
{
    pair <long long, long long> output;
    output = h[r];

    if(l!=0)
    {
        output.first = (output.first - (h[l-1].first*p1[r-l+1])%mod1 + mod1)%mod1;
        output.second = (output.second - (h[l-1].second*p2[r-l+1])%mod2 + mod2)%mod2;
    }

    return output;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int l, r, mid;

    cin >> n >> a >> b;
    cin >> s;
    Init();

    for(int i = n-1;i>=0;i--)
    {
        for(int len = 1;len<=n/2+1;len++)
        {
            if(i+len-1>=n) break;

            arr[length] = {getHash(i, i+len-1), i+len-1};
            length++;

            //cout << "add: " << getHash(i, i+len-1).first << " " << getHash(i, i+len-1).second << '\n';
        }
    }
    sort(arr, arr+length);

    dp[0] = a;
    for(int i = 1;i<n;i++)
    {
        dp[i] = dp[i-1] + a;
        if(value(getHash(i, i))<i)
        {
            //cout << i << "\n";

            //cout << "request: " << getHash(1, i).first << " " << getHash(1, i).second << '\n';
            //cout << checkIn(getHash(1, i)) << " " << value(getHash(1, i)) << '\n';

            l = 1;
            r = i;
            while(l+1<r)
            {
                mid = (l+r)/2;

                if(checkIn(getHash(mid, i))==true && value(getHash(mid, i))<mid) r = mid;
                else l = mid + 1;
            }

            if(checkIn(getHash(l, i))==true && value(getHash(l, i))<l) dp[i] = min(dp[l-1]+b, dp[i]);
            if(checkIn(getHash(r, i))==true && value(getHash(r, i))<r) dp[i] = min(dp[r-1]+b, dp[i]);
        }
    }

    cout << dp[n-1] << '\n';
}


#include<iostream>
#include<string>
#include<set>
#include<map>

using namespace std;

const int MAXN = 5005;
const long long key1 = 29, key2 = 31;
const long long mod1 = 1e9 + 7, mod2 = 1e9 + 9;

int n;
int a, b;
string s;

int dp[MAXN];
long long p1[MAXN], p2[MAXN];
pair <long long, long long> h[MAXN];
map < pair <long long, long long>, int > mp;

void Init()
{
    h[0] = {s[0]-'a'+1, s[0]-'a'+1};
    for(int i = 1;i<n;i++)
    {
        h[i].first = (h[i-1].first*key1 + (s[i]-'a'+1))%mod1;
        h[i].second = (h[i-1].second*key2 + (s[i]-'a'+1))%mod2;
    }

    p1[0] = 1;
    p2[0] = 1;
    for(int i = 1;i<=n;i++)
    {
        p1[i] = (p1[i-1]*key1)%mod1;
        p2[i] = (p2[i-1]*key2)%mod2;
    }
}

pair <long long, long long> getHash(int l, int r)
{
    pair <long long, long long> output;
    output = h[r];

    if(l!=0)
    {
        output.first = (output.first - (h[l-1].first*p1[r-l+1])%mod1 + mod1)%mod1;
        output.second = (output.second - (h[l-1].second*p2[r-l+1])%mod2 + mod2)%mod2;
    }

    return output;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int l, r, mid;

    cin >> n >> a >> b;
    cin >> s;
    Init();

    for(int i = n-1;i>=0;i--)
    {
        for(int length = 1;length<=n/2+1;length++)
        {
            if(i+length-1>=n) break;
            mp[getHash(i, i+length-1)] = i+length-1;
        }
    }

    dp[0] = a;
    for(int i = 1;i<n;i++)
    {
        dp[i] = dp[i-1] + a;
        if(mp[getHash(i, i)]<i)
        {
            l = 1;
            r = i;
            while(l+1<r)
            {
                mid = (l+r)/2;

                if(mp.count(getHash(mid, i))==true && mp[getHash(mid, i)]<mid) r = mid;
                else l = mid + 1;
            }

            if(mp.count(getHash(l, i))==true && mp[getHash(l, i)]<l) dp[i] = min(dp[l-1]+b, dp[i]);
            if(mp.count(getHash(r, i))==true && mp[getHash(r, i)]<r) dp[i] = min(dp[r-1]+b, dp[i]);
        }
    }

    cout << dp[n-1] << '\n';
}


#include<iostream>
#include<string>
#include<set>
#include<map>

using namespace std;

const int MAXN = 5005;
const long long key1 = 29, key2 = 31;
const long long mod1 = 1e9 + 7, mod2 = 1e9 + 9;

int n;
int a, b;
string s;

int dp[MAXN];
long long p1[MAXN], p2[MAXN];
pair <long long, long long> h[MAXN];
map <int, int> mp;

void Init()
{
    h[0] = {s[0]-'a'+1, s[0]-'a'+1};
    for(int i = 1;i<n;i++)
    {
        h[i].first = (h[i-1].first*key1 + (s[i]-'a'+1))%mod1;
        h[i].second = (h[i-1].second*key2 + (s[i]-'a'+1))%mod2;
    }

    p1[0] = 1;
    p2[0] = 1;
    for(int i = 1;i<=n;i++)
    {
        p1[i] = (p1[i-1]*key1)%mod1;
        p2[i] = (p2[i-1]*key2)%mod2;
    }
}

pair <long long, long long> getHash(int l, int r)
{
    pair <long long, long long> output;
    output = h[r];

    if(l!=0)
    {
        output.first = (output.first - (h[l-1].first*p1[r-l+1])%mod1 + mod1)%mod1;
        output.second = (output.second - (h[l-1].second*p2[r-l+1])%mod2 + mod2)%mod2;
    }

    return output;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int l, r, mid;

    cin >> n >> a >> b;
    cin >> s;
    Init();

    for(int i = n-1;i>=0;i--)
    {
        for(int length = 1;length<=n/2+1;length++)
        {
            if(i+length-1>=n) break;
            mp[getHash(i, i+length-1).first] = i+length-1;
        }
    }

    dp[0] = a;
    for(int i = 1;i<n;i++)
    {
        dp[i] = dp[i-1] + a;
        if(mp[getHash(i, i).first]<i)
        {
            l = 1;
            r = i;
            while(l+1<r)
            {
                mid = (l+r)/2;

                if(mp.count(getHash(mid, i).first)==true && mp[getHash(mid, i).first]<mid) r = mid;
                else l = mid + 1;
            }

            if(mp.count(getHash(l, i).first)==true && mp[getHash(l, i).first]<l) dp[i] = min(dp[l-1]+b, dp[i]);
            if(mp.count(getHash(r, i).first)==true && mp[getHash(r, i).first]<r) dp[i] = min(dp[r-1]+b, dp[i]);
        }
    }

    cout << dp[n-1] << '\n';
}


#include<bits/stdc++.h>

#define _FORTIFY_SOURCE 0 //просто херь
#pragma GCC optimize("Ofast") // векторизацию подрубает, ну там сложно
#pragma GCC optimize("no-stack-protector") //хуйня
#pragma GCC optimize("unroll-loops") // у тебя есть фор по 100 он просто берет и повторяет не фор а 100 раз ну иногда ускоряет
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native") // вот здесь потно ну там 03 02 запускает с битами быстрее работает там тоже векторизация
#pragma GCC optimize("fast-math") //быстрее с вещественными работает ну там float оч быстрый становится
using namespace std;

const int N = 2e6 + 6, MOD = 1e9 + 7, mod = 998244353;

const long long INF = 2e17;

#define ss second
#define ff first
//#define int long long
#define double long double
#define pb push_back

using vi = vector <int>;
using vp = vector <pair <int, int>>;

mt19937 Flash_new_51(515151);

int dp[N], z[N];

signed main() {
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;
    for (int i = 0; i <= n; i++) dp[i] = INT_MAX;
    dp[0] = 0;

    for (int i = 0; i < n; i++) {
        dp[i + 1] = min(dp[i + 1], dp[i] + a);
        if (i == 0 ) continue;
        string s1;
        int kol = 0;
        for (int j = i; j < n; j++) s1+= s[j], z[j] = 0;
        kol = s1.size();
        s1+= '$';
        for (int j = 0; j < i; j++) s1+= s[j], z[j] = 0;
        int l = 0, r = 0, maxx = 0;
        z[n] = 0;

        for (int j = kol; j < s1.size(); j++) {
            if (j <= r) z[j] = min(r - j  + 1, z[j - l]);
            while (j + z[j] < s1.size()) {
                if (s1[z[j]] == s1[j + z[j]]) break;
                 z[j]++;
            }

           if (j >= kol) maxx = max(z[j], maxx);
            if (j + z[j] - 1 > r) {
                r = j + z[j] - 1;
                l = j;
            }
        }
        if (maxx) {
            dp[i + maxx] = min(dp[i] + b, dp[i + maxx]);
        }
    }

    cout << dp[n];

}


#include<bits/stdc++.h>

#define _FORTIFY_SOURCE 0 //просто херь
#pragma GCC optimize("Ofast") // векторизацию подрубает, ну там сложно
#pragma GCC optimize("no-stack-protector") //хуйня
#pragma GCC optimize("unroll-loops") // у тебя есть фор по 100 он просто берет и повторяет не фор а 100 раз ну иногда ускоряет
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native") // вот здесь потно ну там 03 02 запускает с битами быстрее работает там тоже векторизация
#pragma GCC optimize("fast-math") //быстрее с вещественными работает ну там float оч быстрый становится
using namespace std;

const int N = 2e6 + 6, MOD = 1e9 + 7, mod = 998244353;

const long long INF = 2e17;

#define ss second
#define ff first
//#define int long long
#define double long double
#define pb push_back

using vi = vector <int>;
using vp = vector <pair <int, int>>;

mt19937 Flash_new_51(515151);

int dp[N];

signed main() {
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;
    for (int i = 0; i <= n; i++) dp[i] = INT_MAX;
    dp[0] = 0;

    for (int i = 0; i < n; i++) {
        dp[i + 1] = min(dp[i + 1], dp[i] + a);
        if (i == 0) continue;
        string s1;
        int kol = 0;
        vi z(n + n, 0);
        for (int j = i; j < n; j++) s1+= s[j], kol++;
        s1+= '$';
        for (int j = 0; j < i; j++) s1+= s[j];
        int l = 0, r = 0, maxx = 0;

        for (int j = kol; j < s1.size(); j++) {
            if (j <= r) z[j] = min(r - j  + 1, z[j - l]);
            while (j + z[j] < s1.size() && s1[z[j]] == s1[j + z[j]]) z[j]++;

            maxx = max(z[j], maxx);
            if (j + z[j] - 1 > r) {
                r = j + z[j] - 1;
                l = j;
            }
        }
        if (maxx) {
            dp[i + maxx] = min(dp[i] + b, dp[i + maxx]);
        }
    }

    cout << dp[n];

}


#include<bits/stdc++.h>

#define _FORTIFY_SOURCE 0 //просто херь
#pragma GCC optimize("Ofast") // векторизацию подрубает, ну там сложно
#pragma GCC optimize("no-stack-protector") //хуйня
#pragma GCC optimize("unroll-loops") // у тебя есть фор по 100 он просто берет и повторяет не фор а 100 раз ну иногда ускоряет
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native") // вот здесь потно ну там 03 02 запускает с битами быстрее работает там тоже векторизация
#pragma GCC optimize("fast-math") //быстрее с вещественными работает ну там float оч быстрый становится
using namespace std;

const int N = 2e6 + 6, MOD = 1e9 + 7, mod = 998244353;

const long long INF = 2e17;

#define ss second
#define ff first
//#define int long long
#define double long double
#define pb push_back

using vi = vector <int>;
using vp = vector <pair <int, int>>;

mt19937 Flash_new_51(515151);

int dp[N], z[N];

signed main() {
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;
    for (int i = 0; i <= n; i++) dp[i] = INT_MAX;
    dp[0] = 0;

    for (int i = 0; i < n; i++) {
        dp[i + 1] = min(dp[i + 1], dp[i] + a);
        if (i == 0 ) continue;
        string s1;
        int kol = 0;
        for (int j = i; j < n; j++) s1+= s[j], kol++, z[j] = 0;
        s1+= '$';
        for (int j = 0; j < i; j++) s1+= s[j], z[j] = 0;
        int l = 0, r = 0, maxx = 0;
        z[n] = 0;

        for (int j = kol; j < s1.size(); j++) {
            if (j <= r) z[j] = min(r - j  + 1, z[j - l]);
            while (j + z[j] < s1.size() && s1[z[j]] == s1[j + z[j]]) z[j]++;

           if (j >= kol) maxx = max(z[j], maxx);
            if (j + z[j] - 1 > r) {
                r = j + z[j] - 1;
                l = j;
            }
        }
        if (maxx) {
            dp[i + maxx] = min(dp[i] + b, dp[i + maxx]);
        }
    }

    cout << dp[n];

}


#include<bits/stdc++.h>

#define _FORTIFY_SOURCE 0 //просто херь
#pragma GCC optimize("Ofast") // векторизацию подрубает, ну там сложно
#pragma GCC optimize("no-stack-protector") //хуйня
#pragma GCC optimize("unroll-loops") // у тебя есть фор по 100 он просто берет и повторяет не фор а 100 раз ну иногда ускоряет
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native") // вот здесь потно ну там 03 02 запускает с битами быстрее работает там тоже векторизация
#pragma GCC optimize("fast-math") //быстрее с вещественными работает ну там float оч быстрый становится
using namespace std;

const int N = 2e6 + 6, MOD = 1e9 + 7, mod = 998244353;

const long long INF = 2e17;

#define ss second
#define ff first
//#define int long long
#define double long double
#define pb push_back

using vi = vector <int>;
using vp = vector <pair <int, int>>;

mt19937 Flash_new_51(515151);

int dp[N], z[N];

signed main() {
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;
    for (int i = 0; i <= n; i++) dp[i] = INT_MAX;
    dp[0] = 0;

    for (int i = 0; i < n; i++) {
        dp[i + 1] = min(dp[i + 1], dp[i] + a);
        if (i == 0 ) continue;
        string s1;
        int kol = 0;
        for (int j = i; j < n; j++) s1+= s[j], kol++;
        s1+= '$';
        for (int j = 0; j < i; j++) s1+= s[j];
        int l = 0, r = 0, maxx = 0;
        fill(z, z + s1.size() + 1, 0);

        for (int j = 0; j < s1.size(); j++) {
            if (j <= r) z[j] = min(r - j  + 1, z[j - l]);
            while (j + z[j] < s1.size() && s1[z[j]] == s1[j + z[j]]) z[j]++;

            maxx = max(z[j], maxx);
            if (j + z[j] - 1 > r) {
                r = j + z[j] - 1;
                l = j;
            }
        }
        if (maxx) {
            dp[i + maxx] = min(dp[i] + b, dp[i + maxx]);
        }
    }

    cout << dp[n];

}


#include<bits/stdc++.h>

#define _FORTIFY_SOURCE 0 //просто херь
#pragma GCC optimize("Ofast") // векторизацию подрубает, ну там сложно
#pragma GCC optimize("no-stack-protector") //хуйня
#pragma GCC optimize("unroll-loops") // у тебя есть фор по 100 он просто берет и повторяет не фор а 100 раз ну иногда ускоряет
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native") // вот здесь потно ну там 03 02 запускает с битами быстрее работает там тоже векторизация
#pragma GCC optimize("fast-math") //быстрее с вещественными работает ну там float оч быстрый становится
using namespace std;

const int N = 2e6 + 6, MOD = 1e9 + 7, mod = 998244353;

const long long INF = 2e17;

#define ss second
#define ff first
//#define int long long
#define double long double
#define pb push_back

using vi = vector <int>;
using vp = vector <pair <int, int>>;

mt19937 Flash_new_51(515151);

int dp[N], z[N];

signed main() {
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;
    for (int i = 0; i <= n; i++) dp[i] = INT_MAX;
    dp[0] = 0;

    for (int i = 0; i < n; i++) {
        dp[i + 1] = min(dp[i + 1], dp[i] + a);
        if (i == 0 ) continue;
        string s1;
        int kol = 0;
        for (int j = i; j < n; j++) s1+= s[j], kol++;
        s1+= '$';
        for (int j = 0; j < i; j++) s1+= s[j];
        int l = 0, r = 0, maxx = 0;
        fill(z, z + s1.size() + 1, 0);

        for (int j = 1; j < s1.size(); j++) {
            if (j <= r) z[j] = min(r - j  + 1, z[j - l]);
            while (j + z[j] < s1.size() && s1[z[j]] == s1[j + z[j]]) z[j]++;

           if (j >= kol) maxx = max(z[j], maxx);
            if (j + z[j] - 1 > r) {
                r = j + z[j] - 1;
                l = j;
            }
        }
        if (maxx) {
            dp[i + maxx] = min(dp[i] + b, dp[i + maxx]);
        }
    }

    cout << dp[n];

}


#include<bits/stdc++.h>

#define _FORTIFY_SOURCE 0 //просто херь
#pragma GCC optimize("Ofast") // векторизацию подрубает, ну там сложно
#pragma GCC optimize("no-stack-protector") //хуйня
#pragma GCC optimize("unroll-loops") // у тебя есть фор по 100 он просто берет и повторяет не фор а 100 раз ну иногда ускоряет
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native") // вот здесь потно ну там 03 02 запускает с битами быстрее работает там тоже векторизация
#pragma GCC optimize("fast-math") //быстрее с вещественными работает ну там float оч быстрый становится
using namespace std;

const int N = 2e6 + 6, MOD = 1e9 + 7, mod = 998244353;

const long long INF = 2e17;

#define ss second
#define ff first
//#define int long long
#define double long double
#define pb push_back

using vi = vector <int>;
using vp = vector <pair <int, int>>;

mt19937 Flash_new_51(515151);

int dp[N];

signed main() {
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;
    for (int i = 0; i <= n; i++) dp[i] = INF;
    dp[0] = 0;

    for (int i = 0; i < n; i++) {
        dp[i + 1] = min(dp[i + 1], dp[i] + a);
        if (i == 0) continue;
        string s1;
        int kol = 0;
        vi z(n + n, 0);
        for (int j = i; j < n; j++) s1+= s[j], kol++;
        s1+= '$';
        for (int j = 0; j < i; j++) s1+= s[j];
        int l = 0, r = 0, maxx = 0;

        for (int j = kol; j < s1.size(); j++) {
            if (j <= r) z[j] = min(r - j  + 1, z[j - l]);
            while (j + z[j] < s1.size() && s1[z[j]] == s1[j + z[j]]) z[j]++;

            maxx = max(z[j], maxx);
            if (j + z[j] - 1 > r) {
                r = j + z[j] - 1;
                l = j;
            }
        }
        if (maxx) {
            dp[i + maxx] = min(dp[i] + b, dp[i + maxx]);
        }
    }

    cout << dp[n];

}