{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv align\u003d\"left\"\u003eThe magical school of nature exists for thousands years. The wizards of the school are mastered in controlling animate nature. But it is still extremely difficult for them to manipulate matter itself. The best mages of the school were trying to learn the ways of manipulating the world around them for a long time. They started with the space distortion. Ancient books mentioned three basic space distortion spells: Translation, Scaling and Rotation. But all the experiments failed because it was extremely hard to predict the way the spell would affect the space. Nowadays the experiments arose again and you are to write the program which would help wizards in predicting of the results of some complex distortion spells. Complex spell consists of N consecutive basic distortion spells. And you are to predict its effect on M control vertices. For your convenience wizards measure the space in some 3-dimensional Cartesian system. \u003cbr\u003eWhile casting Translation spell wizard specifies Translation vector and all the vertices are moved by the given x, y and z values. \u003cbr\u003eWhile casting Scaling spell wizard specifies three Scaling parameters which show the Scaling factor for each of three coordinates (each x, y, and z coordinate of every vertex is multiplied by the corresponding Scaling factor). \u003cbr\u003eWhile casting Rotation spell wizard specifies a point and Rotation angle and all the vertices are rotated in a clockwise direction about the ray from the origin through the specified point. The angle parameter specifies the angle of Rotation in degrees. \u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cbr\u003e\u003cb\u003eInput\u003c/b\u003e\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003eThe first line of the input file contains integer number N (1 \u0026lt;\u003d N \u0026lt;\u003d 1000). The next N lines describe complex spell. Each line contains one basic spell description in order they are applied. The first letter of each line specifies basic spell type. `T\u0027 stands for Translation spell, `S\u0027 stands for Scaling spell and `R\u0027 stands for Rotation spell. For Translation spell Translation vector is specified on the same line (three numbers: x, y, and z). For Scaling spell three Scaling factors are specified on the same line (three numbers: x, y, and z, each not greater than 1 by absolute value). For Rotation spell the point and the angle are specified on the same line (x, y, z and a, x^2+y^2+z^2\u0026gt;0). After that vertices description follows. First an integer number of vertices M is specified (1 \u0026lt;\u003d M \u0026lt;\u003d 100000). Then descriptions of M vertices follow. Each vertex description consists of 3 numbers - Cartesian coordinates of the vertex. \u003cbr\u003eAll the numbers in input are real and do not exceed 1000 by their absolute value. \u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cbr\u003e\u003cb\u003eOutput\u003c/b\u003e\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003eFor each vertex in the input output its coordinates after the entire spell takes effect. \u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cbr\u003e\u003cb\u003eSample test(s)\u003c/b\u003e\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cbr\u003eInput\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cfont face\u003d\"Courier New\"\u003e\u003c/font\u003e\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cpre\u003e\u003c/pre\u003e\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003eTest #1 \u003cbr\u003e3 \u003cbr\u003eT 1.0 -2.4 0.7 \u003cbr\u003eS 0.2 4.0 2.0 \u003cbr\u003eR 0.0 0.0 1.0 2.0 \u003cbr\u003e3 \u003cbr\u003e0.0 0.0 1.0 \u003cbr\u003e0.0 1.0 0.0 \u003cbr\u003e1.0 0.0 0.0 \u003cbr\u003e \u003cbr\u003eTest #2 \u003cbr\u003e3 \u003cbr\u003eS 1.0 2.0 3.0 \u003cbr\u003eR 1.0 0.0 0.0 90.0 \u003cbr\u003eR 0.0 1.0 0.0 90.0 \u003cbr\u003e3 \u003cbr\u003e1.0 0.0 0.0 \u003cbr\u003e0.0 1.0 0.0 \u003cbr\u003e0.0 0.0 1.0 \u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cdiv align\u003d\"left\"\u003e\u003cdiv align\u003d\"left\"\u003e\u003cbr\u003eOutput\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cfont face\u003d\"Courier New\"\u003e\u003c/font\u003e\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cpre\u003e\u003c/pre\u003e\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003eTest #1 \u003cbr\u003e0.53 -9.59 3.40 \u003cbr\u003e0.40 -5.59 1.40 \u003cbr\u003e0.73 -9.58 1.40 \u003cbr\u003e \u003cbr\u003eTest #2 \u003cbr\u003e0.00 0.00 -1.00 \u003cbr\u003e2.00 0.00 0.00 \u003cbr\u003e0.00 -3.00 0.00 \u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cdiv align\u003d\"left\"\u003e\u003cdiv align\u003d\"left\"\u003e\u003cdiv align\u003d\"right\"\u003e \u003c/div\u003e\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003cdiv align\u003d\"right\"\u003e \u003c/div\u003e\u003c/div\u003e\u003cdiv align\u003d\"left\"\u003e\u003chr\u003e\u003c/div\u003e\u003ctable align\u003d\"left\" cellspacing\u003d\"7\"\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd\u003eAuthor:\u003c/td\u003e\u003ctd\u003eIgor A. Kulkin \u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003eResource:\u003c/td\u003e\u003ctd\u003eSaratov SU Contest: Golden Fall 2004 \u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd\u003eDate:\u003c/td\u003e\u003ctd\u003eOctober 2, 2004 \u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003c/div\u003e \u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\r\n\u003c/div\u003e"}}]}