Given a codification, the problem is to write the first N terms of the sequence.
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).
For each test case, the program output is a single line containing the list of first N terms of the sequence.
| Input | Output |
|---|---|
[1+[2+[1]]] 5 | 1 3 6 10 15 |
[2*[1+[2+[1]]]] 6 | 2 6 36 360 5400 113400 |
This platform allows at most20 datasets per input file, codification length at most200 characters and bracket nesting depth at most20. Each integer literal has absolute value at most10^9; coefficients m before an operator are positive integers. For every nested subexpression, every one of its first N terms has absolute value less than10^1000 (at most1000 decimal digits; the minus sign is excluded). N remains between2 and50. These are explicit local resource bounds, including intermediate sequences, introduced after capacity testing.