#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define syosu(x) fixed< P; typedef pair pdd; typedef pair pll; typedef vector vi; typedef vector vvi; typedef vector vd; typedef vector vvd; typedef vector vl; typedef vector vvl; typedef vector vc; typedef vector vvc; typedef vector vs; typedef vector vb; typedef vector vvb; typedef vector

vp; typedef vector vvp; typedef vector vpll; typedef pair pip; typedef vector vip; const int inf=1<<30; const ll INF=1ll<<57; const double pi=acos(-1); const double eps=1e-6; const ll mod=1e9+7; const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,-0}; const int DX[8]={-1,-1,-1,0,1,1,1,0},DY[8]={1,0,-1,-1,-1,0,1,1}; vvl mul(vvl A,vvl B){ vvl C(A.size(),vl(B[0].size())); for(int i=0;i>n>>x>>y; E[0][0]=1; E[1][1]=1; E[2][2]=1; vvl A=E; vector X(n); for(int i=0;i>t; vvl B; if(t==1){ int dx; cin>>dx; B=E; B[0][2]=dx; A=mul(B,A); B[0][2]=-dx; } if(t==2){ int dy; cin>>dy; B=E; B[1][2]=dy; A=mul(B,A); B[1][2]=-dy; } if(t==3){ B=vvl(3,vl(3)); B[0][1]=1; B[1][0]=-1; B[2][2]=1; A=mul(B,A); B[0][1]=-1; B[1][0]=1; } X[i]=B; } for(int i=0;i