Show the Sequence

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∈IN denote a sequence of real numbers whose i-order term is Si. We codify a constant sequence with the following operator: S=[n] meaningthat Si =n ∀i∈IN, where n ∈ Z. We also define the following operators on a given sequence of numbers S = (Si)i∈IN: { V =[m+S] meaningthat Vi = m Vi−1 + Si−1 { V =[m∗S] meaningthat Vi = m∗S1 Vi−1 ∗ Si ,i=1 ; , i > 1 ,i=1 ; , i > 1 where m ∈ IN. For example we have the following codifications: [2+[1]] = 2,3,4,5,6··· [1+[2+[1]]] = 1,3,6,10,15,21,28,36··· [2∗[1+[2+[1]]]]=2,6,36,360,5400,113400··· [2∗[5+[−2]]]=10,30,30,−30,90,−450,3150··· 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 ≤ N ≤ 50). Output For each test case, the program output is a single line containing the list of first N terms of the sequence. Examples Input Output [1+[2+[1]]] 5 1 3 6 10 15 [2*[1+[2+[1]]]] 6 2 6 36 360 5400 113400 Sample Input [2+[1]] 3 [2*[5+[-2]]] 7 Sample Output 234 10 30 30 -30 90 -450 3150