#include #define matrix vector> #define rep(i,n) for(int i=0;i mul_v(matrix a,vector b){ vector tmp{0,0,0}; rep(i,3) rep(j,3){ tmp[i]+=a[i][j]*b[j]; } return tmp; } int main(void){ int n,px,py,i; vector v; cin>>n>>px>>py; rep(i,n){ int a,b; cin>>a; if(a==3){ v.push_back(matrix{{0,1,0},{-1,0,0},{0,0,1}}); }else if(a==1){ cin>>b; v.push_back(matrix{{1,0,b},{0,1,0},{0,0,1}}); }else{ cin>>b; v.push_back(matrix{{1,0,0},{0,1,b},{0,0,1}}); } } for(i=n-1;i>0;i--){ v[i-1]=mul(v[i],v[i-1]); } rep(i,n){ vector ans = mul_v(v[i],vector{px,py,1}); cout<