Problems
Mitin crib
Mitin crib
\includegraphics{https://static.e-olymp.com/content/f3/f32ef649e28fae41af2a3a35297d6d00c8612826.gif}
Mitya was terribly afraid of reference in physics. therefore, he prepared a cheat sheet - long and narrow sheet of paper on which to print all the most important formulas. Leaflet will be too long, so you can just hide under a notebook. I had to turn. Mitya turned aside his sheet only along lines parallel to its original shortest edge. Effects of convolution along such lines, however, can be done in two directions: to turn a piece of paper up, or turn a piece of paper down. In both cases, the two parts of the rectangle are joined neatly together. You can designate the direction of folding the letter \textbf{A}, if the sheet has been folded clockwise rotation, or the letter \textbf{V}, signifying a turn counterclockwise. After a few times Mitya turned sheet of paper, he unfolded it and looked at him sideways. The result was a strange paper "accordion" - curve, consisting of line segments. "Accordion" can be deployed so that between any of its segments would be a \textbf{90} degree angle. Instead of preparing for the control of physics, Mitya began to write a program that is on the list of operations on a piece of paper will print the drawing of the resulting polygonal line. Mitya had turned a lot of cribs, trying to find the regularity of the resulting polygons. Program Mitya not, the clock is ticking and Mitya probably get an F in physics, if you do not help him cope with the problem!
\textbf{Input } In the input file contains multiple non-empty strings of characters \textbf{A} and \textbf{V}, describing the process of folding cribs. The first line contains the number of such lines. You can assume that the length of each line - no more than \textbf{200} characters. One line - this is one Mitina crib. \textbf{Output} For each line of input data display program drawing figures obtained. Start to draw the figure at the point with coordinates (\textbf{300, 420}) the command "\textbf{300 420 moveto}". The first rotation occurs at the point (\textbf{310, 420}) with the command "\textbf{310 420 lineto}". Then proceed clockwise or counterclockwise, rotating according to the input line. To move, use the command sequence "\textbf{x y lineto}" with the appropriate coordinates. Turning points should be located from one another at a distance of \textbf{10}. Complete the program teams "\textbf{stroke}" and "\textbf{showpage}".
Input example #1
2 V AVV
Output example #1
300 420 moveto 310 420 lineto 310 430 lineto stroke showpage 300 420 moveto 310 420 lineto 310 410 lineto 320 410 lineto 320 420 lineto stroke showpage