            implicit real*8(a-h,o-z)
            dimension x(50000),y(50000),z(50000),
     &      sxx(50000),syy(500000),szz(50000),
     &      sxy(50000),syz(500000),szx(50000)
            ymae=999999999999.d0
             open(8,file='sigmah.d')
             open(9,file='sigmahf.d')
             read(8,*) hai
             read(8,*) n
            do i=1,n
             read(8,*) ngomi,nsetten,sxx(i),syy(i),szz(i),
     &                               sxy(i),syz(i),szx(i) 
             if(y(i)<ymae) write(9,*)
             if(abs(syz(i))>hai)syz(i)=syz(i)/abs(syz(i))*hai
             !if(abs(syz(i))>hai) syz(i)=syz(i)*1.d-3
             !write(9,100) -1,nsetten,x(i),y(i),syz(i)
             write(9,100) ngomi,nsetten,sxx(i),syy(i),szz(i),
     &                               sxy(i),syz(i),szx(i) 
             ymae=y(i)
100          format(i3,i10,1p6e12.5)
            end do
             close(8)
             close(9)
            end
