struct M { double x,y,c,s; M operator=(int){ y=s=0; x=c=1; return*this; } }; M operator*(M a,M b){ M m; m.x=a.c*b.x-a.s*b.y+a.x; m.y=a.s*b.x+a.c*b.y+a.y; m.c=a.c*b.c-a.s*b.s; m.s=a.s*b.c+a.c*b.s; return m; } segtree_Point_Prodt; ll n,q,y,i,x; double sintbl[450]; { rep(j,450)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.c=sintbl[x+90]; m.s=sintbl[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); } } }