uses
	sysutils;

var
	n, minc, maxc: longint;
	i, x, y: longint;
	u: array [-1000..1000, -1000..1000] of boolean;
	xx, yy: array [0..10000] of longint;

function ok(x1, y1, x2, y2: longint): boolean;
begin
	ok := 
		(x1 = x2) or
		(y1 = y2) or
		(x1 + y1 = x2 + y2) or
		(x1 - y1 = x2 - y2);
end;

begin
	n := strtoint(paramstr(1));
	minc := strtoint(paramstr(2));
	maxc := strtoint(paramstr(3));
	randseed := strtoint(paramstr(4));

	u[0][0] := true;
	xx[0] := 0;
	yy[0] := 0;
	for i := 1 to n do begin
		repeat
			x := minc + random(maxc - minc + 1);
			y := minc + random(maxc - minc + 1);
		until not u[x][y] and (ok(x, y, xx[i - 1], yy[i - 1]) or ((i > n div 2 + 1) and (random(n div 2) = 0)));
		u[x][y] := true;
		xx[i] := x;
		yy[i] := y;
	end;

	writeln(n);
	for i := 1 to n do begin
		writeln(xx[i], ' ', yy[i]);
	end;
end.