program expand;
var
ch:char;
p1,p2,p3:integer;
s:string;
procedure init;
begin
assign(input,'expand.in');reset(input);
assign(output,'expand.out');rewrite(output);
readln(p1,p2,p3);
readln(s);
close(input);
end;
procedure expand(x,y:char;a,b,c:integer);
var
i,z:char;
j:integer;
begin
case c of
1:begin
i:=succ(x);
while i<y do begin
z:=i;
if a=2 then if z in ['a'..'z'] then z:=chr(ord(z)-97+65);
if a=3 then z:='*';
for j:=1 to b do write(z);
i:=succ(i);
end;
end;
2:begin
i:=pred(y);
while i>x do begin
z:=i;
if a=2 then if z in ['a'..'z'] then z:=chr(ord(z)-97+65);
if a=3 then z:='*';
for j:=1 to b do write(z);
i:=pred(i);
end;
end;
end;
end;
procedure main;
var
i,l:integer;
t1,t2:char;
begin
l:=length(s);
write(s[1]);
for i:=2 to l-1 do begin
if s[i]<>'-'
then write(s[i])
else begin
t1:=s[i-1]; t2:=s[i+1];
if (t1 in ['a'..'z']) and (t2 in ['a'..'z']) or (t1 in ['0'..'9'])and(t2 in ['0'..'9'])
then begin
if (t1>=t2) then write('-')
else expand(t1,t2,p1,p2,p3);
end
else write('-');
end;
end;
writeln(s[l]);
end;
begin
init;
main;
close(output);
end.