#include using namespace std; int main() { int N, M; cin >> N >> M; vector l( M ); for( int i = 0; i < M; i++ ) { cin >> l[i]; } vector v( N ); vector u( N ); int dir = 1; int id = 0; for( int i = 0; i < M; i++ ) { if( l[i] == "number" ) { v[id]++; } else if( l[i] == "drawtwo" ) { int two = 0; v[id]++; two++; int j; for( j = i + 1; j < M && l[j] == "drawtwo"; j++ ) { id += dir; if( id < 0 ) id = N - 1; else if( id >= N ) id = 0; v[id]++; two++; } if( j == M ) break; id += dir; if( id < 0 ) id = N - 1; else if( id >= N ) id = 0; u[id] += two * 2; i = j - 1; } else if( l[i] == "drawfour" ) { int four = 0; v[id]++; four++; int j; for( j = i + 1; j < M && l[j] == "drawfour"; j++ ) { id += dir; if( id < 0 ) id = N - 1; else if( id >= N ) id = 0; v[id]++; four++; } if( j == M ) break; id += dir; if( id < 0 ) id = N - 1; else if( id >= N ) id = 0; u[id] += four * 4; i = j - 1; } else if( l[i] == "skip" ) { v[id]++; if( i + 1 < M ) id += dir; if( id < 0 ) id = N - 1; else if( id >= N ) id = 0; } else if( l[i] == "reverse" ) { v[id]++; dir *= -1; } if( i < M - 1 ) { id += dir; if( id < 0 ) id = N - 1; else if( id >= N ) id = 0; } } cout << id + 1 <<" " << v[id] - u[id] << endl; }