double sintbl[360]; struct M { double x,y;int d; void operator=(int){ x=1; y=0; d=0; } }; M operator*(M a,M b){ double c=sintbl[(a.d+90)%360]; double s=sintbl[a.d%360]; return { c*b.x-s*b.y+a.x, s*b.x+c*b.y+a.y, a.d+b.d, }; } segtree_Point_Prodt; ll n,q,y,i,x; { rep(j,360)sintbl[j]=sin(PI/180*j); rd(n,q); t.walloc(n+1,1); rep(q){ rd(y,i); if(y==0){ rd(x); M m=t[i-1]; m.d=x; t.change(i-1,m); } if(y==1){ rd(x); M m=t[i]; m.x=x; t.change(i,m); } if(y==2){ M m=t.getProd(0,i+1); wt(m.x-1,m.y); } } }