#include int main(){ using namespace std; unsigned long N, M; cin >> N >> M; string X; cin >> X; X.push_back('1'); vector dif; for(unsigned long i{}; i < M; ++i)if(X[M - i] != X[M - i - 1])dif.emplace_back(i); vector> ops; const auto operation{[&N, &ops](unsigned long t, unsigned long x, unsigned long y, unsigned long z){ ops.emplace_back(t, x ? x + N : x, y ? y + N : y, z ? z + N : z); }}; operation(2, 0, 0, 0); if(!empty(dif)){ for(unsigned long i{}; i < dif.back(); ++i)operation(1, i + 1, i, 0); reverse(begin(dif), end(dif)); for(const auto& i : dif)operation(2, 0, 0, i); } cout << size(ops) << endl; for(const auto& [t, x, y, z] : ops)if(t == 1)cout << t << " " << x << " " << y << endl; else cout << t << " " << x << " " << y << " " << z << endl; return 0; }