int N, S, T; double P[1d5], Q[], R[], X, Y, rx, ry; Matrix m[3], mt; segtree_Point_Prod> t; rd(N,(P,Q,R)(N)); t.walloc(N); t.setN(N); rep(i,3) m[i].changeSize(3,3); rep(i,N){ m[0] = m[1] = m[2] = 1; (m[0][2][0], m[0][2][1]) = (-P[i], -Q[i]); (m[2][2][0], m[2][2][1]) = (P[i], Q[i]); m[1][0][0] = m[1][1][1] = cos(R[i] * PI / 180); m[1][0][1] = sin(R[i] * PI / 180); m[1][1][0] = -sin(R[i] * PI / 180); t[i] = m[0] * m[1] * m[2]; } t.build(); REP(rd_int()){ rd(S--,T,X,Y); mt = t.getProd(S, T); rx = X * mt[0][0] + Y * mt[1][0] + mt[2][0]; ry = X * mt[1][1] + Y * mt[1][1] + mt[2][1]; wt(rx,ry); }