C+
C NAME:
C	iArrI4Total
C PURPOSE:
C	Get sum of all elements in integer*4 array
C CALLING SEQUENCE:
	function iArrI4Total(N,A,M)
C INPUTS:
C	N	integer		# elements in array
C				If N < 0 then array elements
C				set to BadR4 are skipped
C	A(*)	integer		array
C OUTPUTS:
C	R	integer		sum
C	M	integer		# elements contributing
C				to sum (if N > 0 then M=N)
C CALLS:
C	BadI4
C SEE ALSO:
C	Array_Info
C-
	    integer	N
	    integer	A(*)
	    integer	M

	integer		S
	integer		BadI4

	ibad = BadI4()

	S = 0
	M = 0

	if (N .gt. 0) then
	    do I=1,N
		S = S+A(I)
	    end do
	    M = N
	else if (N .lt. 0) then
	    do I=1,-N
		if (A(I) .ne. ibad) then
		    S = S+A(I)
		    M = M+1
		end if
	    end do
	end if

	iArrI4Total = S

	return
	end
