    subroutine isub(nx,x,iq,ny,y,isgn)
    parameter  q=10
    integer(4) ix,nx,iy,ny,iz,nz,x1,y1
    integer(4) x(0:*),y(0:*),isgn
!    print 102,"isub:x=",x(0:nx)
    !  takes x=x-y displaced by id places
    do  iy=0,ny
        iz=iy+iq
        x(iz)=x(iz)-y(iy)        
    enddo
    write(1,102)"int step:",x(0:nx)
!  do borrow operation
    do iy=0,ny
    iz=iq+iy
    x1=x(iz)
        if(x1 < 0)then
            x(iz)  =x1+q
            x(iz+1)=x(iz+1)-1  
        endif 
        write(1,101)"iz=",iz," x=",x(iz:iz+1)
    enddo
    if(x(iz+1) < 0)then
        print *,"went negative !"
        isgn=-1
        return
    endif
    isgn=1
    write(1,102)"x after isub:",x(0:nx)
101 format(A,I5,A,10I5)
102 format(A/(30i3))
    end
