{$APPTYPE CONSOLE}

Uses
  SysUtils;

var
  maxn, maxa, maxd, maxp : int64;

  problems: array [1 .. 100000, 1 .. 2] of int64;
  i, n: integer;
  A: int64;

begin
  randseed := StrtoInt(ParamStr(1));
  maxn := StrtoInt(ParamStr(2));
  maxa := StrtoInt(ParamStr(3));
  maxd := StrtoInt(ParamStr(4));
  maxp := StrtoInt(ParamStr(5));
  n := random(maxn) + 1;
  A := random(maxa) + 1;
  for i := 1 to n do begin
    problems[i, 1] := random(maxd) + 1;
    problems[i, 2] := random(maxp) + 1;
  end;
  writeln(n, ' ', A);
  for i := 1 to n do
    writeln(problems[i, 1], ' ', problems[i, 2]);
end.
