PLOT1 - Plotting functions (variation)

Given a function y=f(x) in RPN-notation plot it with stars (*) and then (!) its derivation with crosses (+) for 0<=x<=20 with Δx=1 in a diagram with 21*21 points (0<=x,y<=20). Empty fields are marked with dots (.). For plotting the real number y should be rounded to integer (-0.5 -> -1, -0.4 -> 0, 0.4 -> 0, 0.5 -> 1). The function and its derivation are continuous between 0 and 20.
The function definition uses only the following characters: 0123456789x.+-*/^
'^' means 'power of'. Items are separated by space.

Input

In the first line the number N of functions, then N lines with one function.

Output

The plot of each function and its derivation in 21 lines.

Example

Input:
1
x 1 - Output: .....................
....................*
...................*.
..................*..
.................*...
................*....
...............*.....
..............*......
.............*.......
............*........
...........*.........
..........*..........
.........*...........
........*............
.......*.............
......*..............
.....*...............
....*................
...*.................
+++++++++++++++++++++
.*...................

Added by:HWK
Date:2011-03-02
Time limit:0.100s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.