A new model of a mobile phone is powered by a special sound generation processor, developed expressly for this purpose.
The processor has a sound generator, an instruction pointer (IP), command memory (100 cells) and a stack (100 cells).
The instruction set of this processor consists of the two commands only:
CALL X – a subroutine call command – pushes the incremented current value of the IP (the return address) on the top of the stack and sets the IP to X;
BELL&RET – the combined command “bell-return” – emits a sound of a fixed (unit) duration and performs control return (pops a value from the top of the stack and assigns it to the IP) or stops the execution of the program (if the stack is empty).
Any command (together with its operand) occupies exactly one memory cell.
The return address occupies only one cell on the stack, too.
The work cycle of the processor starts when it is necessary to emit a sound. At this moment the IP points to the zero memory cell. The processor stops its work if the stack is empty after emitting a sound (when BELL&RET command has been executed).
The manufacturers of the processor affirm that by using of this processor may be emitted sound of rather long duration.
Your task is to write a program, which accepts K as input and produces a program for this processor to emit a sound of duration K.
The resulting program may have no more than 100 commands including exactly one BELL&RET command, being always the last one.
Unused memory cells following the BELL&RET command are considered free.
There will be one integer number K in the input (0 < K ≤ 109) – sound duration.
Output a program for the processor described above. The execution of this program leads to emission of the sound of duration K. The first line should correspond to the zero cell of the memory, the second line – to the first cell, the third – to the second one etc. All lines, with exception for the last one, may contain only CALL commands. The operand of the CALL command is an integer (from 1 to 99) and must be separated from the command by a white-space character.
The last line must contain the BELL&RET command.
Автор задачи: © Sergey G. Volchenkov, 2003(firstname.lastname@example.org); Vladimir N. Pinaev, 2003(email@example.com; http://www.pic200x.chat.ru); Michael Y. Kopachev, 2003 (firstname.lastname@example.org).
Источник задачи: 2003-2004 ACM Central Region of Russia Quarterfinal Programming Contest, Rybinsk, October 15-16, 2003