const
  nmax=1000;
var
  a,b,q,p,ii,n,i,j,m,a1,b1:longint;
  t:array[1..nmax,1..nmax] of boolean;
  f,g:text;
begin
  assign(f,'input.txt');
  assign(g,'output.txt');
  reset(f);
  rewrite(g);
  readln(f,a,b,q,p,n);
  for i:=1 to nmax do
    for j:=1 to nmax do
      t[i,j]:=false;

  for i:=n downto 2 do
   begin
     for j:=1 to i-1 do
      begin
       ii:=i-j;
       if (ii+p+j>n) or (ii+j+p>n) or (ii*q+j>n) or (ii+j*q>n) or
          (not t[ii+p,j]) or
          (not t[ii,j+p]) or
          (not t[ii*q,j]) or
          (not t[ii,j*q])
        then t[ii,j]:=true;
      end;
   end;

   for i:=1 to n do 
   begin
     for j:=1 to n do 
        if (t[i,j]) write(1) else write(0);
     Writeln;
  end;  
  

   a1:=0;
   b1:=0;
  if (a+b>n) or (t[a,b]) then
     begin

        if (a+p+b>n) or (not t[a+p,b])then begin a1:=a+p; b1:=b end;
        if ((a*q+b>n) or (not t[a*q,b])) and (a*q>a1) then
           begin
             a1:=a*q;
             b1:=b
           end;
        if (a+p+b<=n) and (t[a+p,b]) and  (a*q+b<=n) and (t[a*q,b])
           then
             begin
               if (a+b+p>n) or (not t[a,b+p]) then begin a1:=a; b1:=b+p end;
               if ((a+b*q>n) or (not t[a,b*q])) and (b*q>b1) then
                  begin
                    a1:=a;
                    b1:=b*q;
                  end
             end;
        writeln(g,'1 ',a1,' ',b1);
     end
     else
        writeln(g,'2');

  close(f);
  close(g);

end.
