import sys

# 读取参数和字符串
p1, p2, p3 = map(int, input().split())
s = input()

lower_char_bet = "abcdefghijklmnopqrstuvwxyz"

# 改用列表处理字符串(方便精准替换,避免replace的全局替换问题)
s_list = list(s)
i = 0  # 手动控制索引,避免长度变化导致的遍历问题

while i < len(s_list):
    # 1. 先判断i是否在有效范围(避免i-1/i+1越界)
    if i > 0 and i < len(s_list) - 1 and s_list[i] == "-":
        left_char = s_list[i - 1]
        right_char = s_list[i + 1]

        # 情况1:- 两侧是数字且左<右
        if left_char.isdigit() and right_char.isdigit() and left_char < right_char:
        
            # 生成数字替换串:左+1 到 右-1,每个数字重复p2次
            new_str = ""
            for num in range(int(left_char) + 1, int(right_char)):
                char=str(num)
                if p1 == 3:
                # p1=3时用*重复p2次
                    char ="*"
                new_str +=char*p2 
            # 按p3决定是否反转
            if p3 == 2:
                new_str = new_str[::-1]
            # 精准替换当前位置的-(删除-,插入新字符串)
            del s_list[i]
            # 插入新字符(从i位置开始)
            for char in new_str[::-1]:  # 插入保证顺序正确,下标不断后移i++
                s_list.insert(i, char)

        # 情况2:- 两侧是小写字母且左<右
        elif left_char.islower() and right_char.islower() and left_char < right_char:
            start = lower_char_bet.index(left_char)
            end = lower_char_bet.index(right_char)
            # 生成字母替换串:start+1 到 end-1
            new_str = ""
            for idx in range(start + 1, end):
                char = lower_char_bet[idx]
                # 按p1决定大小写
                if p1 == 2:
                    char = char.upper()
                if p1==3:
                    char = "*"
                new_str +=char* p2
            # 按p3决定是否反转
            if p3 == 2:
                new_str = new_str[::-1]
            # 精准替换当前位置的-
            del s_list[i]
            for char in new_str[::-1]:
                s_list.insert(i, char)
    # 索引递增(只有未替换时才+1,替换后长度变化,i不递增)
    i += 1

# 转换回字符串并输出
print("".join(s_list))