# UVa 997 - Show the Sequence

## contents

The problem of finding the next term of a given sequence of numbers is usually proposed in QI tests. We want to generate the N terms of a sequence from a given codification of the sequence.

Let S = (Si)i $\scriptstyle \in$$\scriptstyle \mathbb {N} denote a sequence of real numbers whose i -order term is Si . We codify a constant sequence with the following operator: S = [ n] meaning that Si = n \displaystyle \foralli\displaystyle \in$$\displaystyle \mathbb {N}$,

where n$\in$$\mathbb {Z} . We also define the following operators on a given sequence of numbers S = (Si)i \scriptstyle \in$$\scriptstyle \mathbb {N}$ :

V = [ m + S ] meaning that
$Vi = \displaystyle \cases{m & , <span>$i=1$</span><!-- Has MathJax --> \cr V<em>{i-1}+ S</em>{i-1} &amp; , <span>$i &gt; 1$</span><!-- Has MathJax --> \cr};<br>$

V = [ m * S ] meaning that
$Vi = \displaystyle \cases{m \ast S_{1} & , <span>$i=1$</span><!-- Has MathJax --> \cr V_{i-1} \ast S_i &amp; , <span>$i &gt; 1$</span><!-- Has MathJax --> \cr};<br>$

where m$\in$$\mathbb {N}$ . For example we have the following codifications:

Given a codification, the problem is to write the first N terms of the sequence.

## Input

The input file contains several test cases. For each of them, the program input is a single line containing the codification, without any space, followed by an integer N(2$\le$N$\le$50) .

## Output

For each test case, the program output is a single line containing the list of first N terms of the sequence.