namespace AtCoder; #nullable enable using System.Numerics; static class Extensions { public static T[] Repeat(this int time, Func F) => Enumerable.Range(0, time).Select(_ => F()).ToArray(); public static int ToFlag(this int i) { if (i < 0 || 31 <= i) throw new IndexOutOfRangeException(); return 1 << i; } public static bool OfFlag(this int value, int i) => (value & ToFlag(i)) > 0; public static int WithFlag(this int value, int i, bool f) => f ? (value | ToFlag(i)) : (value & ~ToFlag(i)); } class AtCoder { object? Solve() { var n = 50; var m = Int(); var qz = n.Repeat(Int); var oi = -1; for (var i = 0; i < n; i++) if (qz[i] == 1) oi = i + 1; var si = -1; for (var i = 0; i < n; i++) if (qz[i] != 1) si = i + 1; var ops = new List(); for (var i = 1; i <= n; i++) ops.Add(new[]{ 1, i }); var used = new HashSet(){ oi, si }; var mz = new List(){ si }; for (var i = 1; i <= n; i++) { if (used.Contains(i)) continue; mz.Add(i); if (mz.Count == 31) break; } var mc = mz.Count; for (var i = 1; i < mc; i++) { var lj = mz[i - 1]; var j = mz[i]; ops.Add(new[]{ 3, lj, lj, j }); } var start = -1; for (var i = 0; i < 31; i++) { if (!(m - 1).OfFlag(i)) continue; if (start < 0) { start = mz[i]; continue; } ops.Add(new[]{ 3, start, mz[i], start }); } { var nmz = new List() { start }; foreach (var mv in mz) if (mv != start) nmz.Add(mv); mz = nmz; } for (var i = 1; i < mc; i++) { var lj = mz[i - 1]; var j = mz[i]; ops.Add(new[]{ 4, lj, lj, j }); } start = -1; for (var i = 0; i < 31; i++) { if (!m.OfFlag(i)) continue; if (start < 0) { start = mz[i]; continue; } ops.Add(new[]{ 4, start, mz[i], start }); } for (var i = 1; i <= n; i++) if (i != oi) ops.Add(new[] { 3, start, i, start }); Out(ops.Count); foreach (var op in ops) Out(op, " "); return null; } public static void Main() => new AtCoder().Run(); public void Run() { var res = Solve(); if (res != null) { if (res is bool yes) res = yes ? "Yes" : "No"; sw.WriteLine(res); } sw.Flush(); } string[] input = Array.Empty(); int iter = 0; readonly StreamWriter sw = new(Console.OpenStandardOutput()) { AutoFlush = false }; string String() { while (iter >= input.Length) (input, iter) = (Console.ReadLine()!.Split(' '), 0); return input[iter++]; } T Input() where T : IParsable => T.Parse(String(), null); int Int() => Input(); void Out(object? x, string? separator = null) { separator ??= Environment.NewLine; if (x is System.Collections.IEnumerable obj and not string) { var firstLine = true; foreach (var item in obj) { if (!firstLine) sw.Write(separator); firstLine = false; sw.Write(item); } } else sw.Write(x); sw.WriteLine(); } }