Macros
Barash decided to enter a literary contest for programmers, where poems could be submitted in four languages: Assembly, Foxy, Lispy, and Prology. Being a seasoned poet-programmer, Barash only recognized Assembly as a true language, so he chose to write his poem in it. He fired up his trusty edit.com on Dos 6.22 and began crafting his masterpiece. As a lazy programmer, Barash relied heavily on macros, which sped up his poetic process significantly, thanks to his extensive collection of templates, like any seasoned poet-programmer.
The poem was a work of art, but after discussing it with his friend Nyusha, Barash realized that its complexity made it inaccessible to most art enthusiasts. To convey the poem's deeper meaning, Barash decided to simplify it by eliminating macro definitions through macro substitution.
The challenge was that one macro definition could include other macro definitions. Additionally, Barash loved cyclic macro generation, which was evident in his work. Lacking the emotional strength to dismantle his creation himself, he turned to you for help. Assist Barash!
Input
You are given a poem containing macro definitions. The format for these definitions is as follows (each '_' character in the input and output files represents exactly one space):
1. Macro definition:
#identificator_{[text]}
The identifier (macro name) consists of no more than 10 lowercase Latin letters. There are no macro definitions named 'rep'.
2. Macro calls:
##identificator_
3. Cyclic macro definitions:
#rep_n_{[text]}
n is the number of times the text [text] is repeated (0 <= n <= 100).
A block is defined as the text [text] enclosed in curly braces. The entire poem is also considered a block. Any block may contain other macro definitions and macro calls.
A macro definition is active for all subsequent text within the current block and any nested blocks, unless a macro with the same name is redefined in a nested block. If a nested block contains a macro definition with the same name as one in an outer block, the inner block's definition takes precedence. Two macro definitions with the same name cannot exist within the same block.
Recursive calls do not occur. Calls to non-existent macro definitions are ignored. Any macro calls that appear before their definitions in the poem's text are considered non-existent and are ignored.
Output
Provide the revised text of the poem.