#pragma GCC target ("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include #include using namespace std; #define rep(i,n) for(int i=0;i> n; rep(i, n) { double p, q, theta; cin >> p >> q >> theta; theta = theta*pi / 180.0; M[i][0][0] = cos(theta); M[i][0][1] = -sin(theta); M[i][0][2] = q*sin(theta) - p*cos(theta) + p; M[i][1][0] = sin(theta); M[i][1][1] = cos(theta); M[i][1][2] = -p*sin(theta) - q*cos(theta) + q; } int q; cin >> q; rep(j, q) { int s, t; double x, y; cin >> s >> t >> x >> y; double nx, ny; for (int i = s - 1; i < t; i++) { nx = M[i][0][0] * x + M[i][0][1] * y + M[i][0][2]; ny = M[i][1][0] * x + M[i][1][1] * y + M[i][1][2]; x = nx; y = ny; } printf("%.13lf %.13lf\n", x,y); } }