{$apptype console}
{$o-,r+,q+}
uses
  sysutils, math;

const
  maxn = 1000;
  maxa = 1000;
  mina = -1000;
  minc = -10;
  maxc = 10;

type
  int = longint;

procedure swap(var a, b : int);
var
  t : int;
begin
  t := a;
  a := b;
  b := t;
end;

function nextBound() : int;
begin
  result := random(maxa - mina + 1) + mina;
end;

function nextCoeff() : int;
begin
  result := random(maxc - minc + 1) + minc;
end;

var
  n, i : int;
  a, b, p, q, r : int;

begin
  randseed := strtoint(paramstr(1));
  n := random(maxn) + 1;
  writeln(n);
  for i := 1 to n do
  begin
    a := nextBound();
    b := nextBound();
    if (b < a) then
    begin
      swap(a, b);
    end;  
    p := nextCoeff();
    while (p = 0) do
    begin
      p := nextCoeff();
    end;
    q := nextCoeff();
    r := nextCoeff();
    writeln(a, ' ', b, ' ', p, ' ', q, ' ', r);
  end;  
end.