print((function (f, fh) local a,m,n = {},fh:read("*n"),fh:read("*n") if m==0 then for i=1,n do f(a,i*5) end else for i=0,n do for j=(i==0 and 1 or 0),(m<5 and m or 4) do f(a,i*5+j) end end for i=5,m do f(a,n*5+i) end end return table.concat(a,"\n") end)(table.insert, io.stdin))