program main
    integer:: h,w,a,b
    integer, allocatable:: mnum(:,:)
    integer:: i,j,k, ws, hs
    integer,allocatable:: mh(:,:),mw(:,:)
    integer, allocatable:: m0, m1
    read*, h,w,a,b
    allocate(mnum(h,w))
    allocate(mh(2,h), mw(2,w))

    mnum(:,:) = 0
    do j = 1, w
        do i = 1, h
            ws = sum(mnum(i,:))+1
            hs = sum(mnum(:,j))+1
            if(ws > a .or. hs > b)cycle
            mnum(i,j) = 1
        end do
    end do

    do i = 1, h
        print*, mnum(i, :)
    end do



end program