#include <stdio.h>
#include <ctype.h>
void strch(char a, char b, int p1, int p2, int p3);
int main(void)
{
char pre, next;
int p1, p2, p3;
scanf_s("%d %d %d", &p1, &p2, &p3);
getchar();
pre = getchar();
next = getchar();
while (next != '\n')
{
if (next == '-')
{
next = getchar();
strch(pre, next, p1, p2, p3);
}
else
{
putchar(pre);
}
pre = next;
if (pre == '\n')
break;
next = getchar();
}
putchar(pre);
return 0;
}
void strch(char a, char b, int p1, int p2, int p3)
{
if (!(isalpha(a) && isalpha(b)) && !(isdigit(a) && isdigit(b)))
{
printf("%c-", a);
}
else if (a >= b)
{
printf("%c-", a);
}
else if (b == a + 1)
{
printf("%c", a);
}
else
{
putchar(a);
for (int i = 1; i < b - a; i++)
{
switch (p3)
{
case 1:
for (int j = 1; j <= p2; j++)
{
switch (p1)
{
case 1:
putchar(tolower(a + i));
break;
case 2:
putchar(toupper(a + i));
break;
default:
putchar('*');
}
}
break;
case 2:
for (int j = 1; j <= p2; j++)
{
switch (p1)
{
case 1:
putchar(tolower(b - i));
break;
case 2:
putchar(toupper(b - i));
break;
default:
putchar('*');
}
}
}
}
}
}