{$apptype console}

uses
  Math, SysUtils;

var
  i, j: integer;
  howOften: integer;
begin
  RandSeed := StrToInt(ParamStr(1));
  howOften := StrToInt(ParamStr(2));

  writeln(52 * 7);
  for i := 1 to 52 do
    for j := 1 to 7 do
      case Random(howOften) of
        0:
          writeln(i, ' ', j, ' ', j + 1);  // more pizzas
        else
          writeln(i, ' ', j, ' ', j);      // normal
      end;
end.
