      SUBROUTINE NEWTON (FUNC,A,B,N,S,IER)
C
      IMPLICIT REAL*8(A-H,O-Z)
      COMPLEX*16 FUNC,Y,FX,Q,S
C
      IF(N.LT.1)THEN
        IER=1000
        S=(0.D0,0.D0)
        GO TO 9999
      END IF
      IF(A.EQ.B)THEN
        IER=2000
        S=(0.D0,0.D0)
        GO TO 9999
      END IF
C
      H=(B-A)/N
      Y   = FUNC(A)
      Q=(0.D0,0.D0)
C
      DO  100 I=1,N
      X=A+H*I
      FX = FUNC(X)
      Q   = Q+H*(Y+FX)/2.D0
      Y   = FX
  100 CONTINUE
C
      S = Q
      IER=0
C
 9999 RETURN
C
      END
