The Geometer's Sketchpad is a popular commercial interactive geometry software program for exploring Euclidean geometry, algebra, calculus, and other areas of mathematics.
The Geometer's Sketchpad can solve most problems of plane geometry and plane analytic geometry, but it's powerless to solve solid geometry problems. Therefore, the famous mathematician BG, decided to develop a new software, named The Geometer's Sketchpad 3D.
Because of the huge amount of work to do, BG decided to start from basic three-dimensional transformations. Similar to two-dimensional transformations, three-dimensional transformations include three basic types:
1. Translation.
2. Scaling.
3. Rotation.
Now there are $n$ points $P_1,P_2,P_3,\ldots,P_n$ in the three-dimensional space, and BG wanted to implement the following several transformation operations:
1. For given integers $l,r,x,y,z$, translate points $P_l,P_{l+1},P_{l+2},\ldots,P_r$ by the vector $(x,y,z)$ at the same time;
2. For given integers $l,r,x,y,z$ and the real number $k$, scale points $P_l,P_{l+1},P_{l+2},\ldots,P_r$ by the scale factor $k$ and the center point $(x,y,z)$ at the same time;
3. For given integers $l,r,x,y,z,x',y',z'$ and the real number $\theta$, rotate points $P_l,P_{l+1},P_{l+2},\ldots,P_r$ counterclockwise around the axis determined by the point $(x,y,z)$ and the direction vector $(x',y',z')$ through an angle $\theta$ (in radian) at the same time.
In addition, there are some measurement operations:
1. For given integer $i$, calculate the current coordinates of the point $P_i$;
2. For given integers $l,r$, calculate the current length of the polygonal chain $P_{l}P_{l+1}P_{l+2}\cdots P_{r}$. In other words, just calculate $|P_lP_{l+1}|+|P_{l+1}P_{l+2}|+\cdots+|P_{r-1}P_r|$, where $|PQ|$ means the Euclidean distance between points $P$ and $Q$.