program cogs1788;
var
a,b:longint;
s:ansistring;
d,x:array[0..5000]of longint;
tot,i,j,k,n:longint;
procedure init;
begin
assign(input,'WinCHG.in');reset(input);
assign(output,'WinCHG.out');rewrite(output);
end;
function min(a,b:longint):longint;
begin
if a<b then exit(a);
exit(b);
end;
procedure main;
begin
readln(s);n:=length(s);
readln(a,b);
for i:=1 to n do
for j:=1 to i-1 do
begin
k:=j;tot:=0;
while(i+tot<=n)and(s[k]=s[i+tot]) do
begin
inc(tot);
inc(k);
if k>=i then k:=j;
end;
if tot>x[i] then x[i]:=tot;
end;
for i:=1 to n do
begin
if i=1 then d[i]:=a else d[i]:=a+d[i-1];
for k:=1 to i-1 do
begin
if x[k]<i-k+1 then continue;
if k<>1 then d[i]:=min(d[i],d[k-1]+b)
else d[i]:=min(d[i],b);
end;
end;
writeln(d[n]);
end;
begin
init;
main;
end.