#include #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep1(i,n) for(int i=1;i<=(int)(n);i++) #define all(c) c.begin(),c.end() #define pb push_back #define fs first #define sc second #define show(x) cout << #x << " = " << (x) << endl #define chmin(x,y) x=min(x,y) #define chmax(x,y) x=max(x,y) using namespace std; template ostream& operator<<(ostream& o,const pair &p){ return o<<"("< ostream& operator<<(ostream& o,const vector &vc){ o<<"{"; for(const T& v:vc) o< using V = vector; template using VV = vector>; int main(){ int N,M; cin>>N>>M; V a(N); int x = 0; int d = 1; string prev; int px = -1; rep(i,M){ px = x; string s; cin>>s; a[x]--; if(s == "number"){ x = (x+d+N)%N; } if(s == "skip"){ x = (x+d+d+N)%N; } if(s == "reverse"){ d = -d; x = (x+d+N)%N; } if(s == "drawtwo"){ if(prev == "drawtwo"){ a[x]++; x = (x-d+N)%N; a[x]--; } a[(x+d+N)%N] += 2; x = (x+d+d+N)%N; } if(s == "drawfour"){ if(prev == "drawtwo"){ a[x]++; x = (x-d+N)%N; a[x]--; } a[(x+d+N)%N] += 4; x = (x+d+d+N)%N; } prev = s; } cout<