      IMPLICIT REAL*8 (A-H,O-Z)
      PARAMETER (MAXGUIDE=7,MAXPTS=65)
	COMMON /GUIDE/ GCON(MAXGUIDE),NGUIDE
      COMMON /PTS/ SPTS(MAXPTS),SVAL(MAXPTS),SINT(MAXPTS),SDER(MAXPTS)
      COMMON /MISC/ PI
      DIMENSION X(3,2),RA(3),RB(3)
	DATA RA/0D0,0D0,-.7D0/
	DATA RB/0D0,0D0,.7D0/ 			
	DATA NMC/1048576/
C	DATA NMC/8192/
      PI=ACOS(-1D0)
	NUP=2
	NGUIDE=1
	GCON(1)=-1
	beta=-.123
	alpha=1.7
	CALL RSEED(123,451)
      CALL SETUP(NGUIDE,GCON)
	SUM=0
	SUM2=0
	DO IMC=1,NMC
C PICK FIRST ELECTRON BIASED AS RANDOM
	  CALL XNFIND(X,WXT,1)
	  XTEMP=RNDMF(1.)
	  IF(XTEMP.LT..5)THEN
	    DO J=1,3
	      X(J,1)=X(J,1)+RA(J)
	    ENDDO
	  ELSE
	    DO J=1,3
	      X(J,1)=X(J,1)+RB(J)
	    ENDDO
	  ENDIF
	  DO I=2,NUP
C PICK ELECTRON 2 WITH RESPECT TO NUCLEUS AND ELECTRONS
	    CALL XNEFIN(X,WNXT,I-1,I)
	    XTEMP=RNDMF(1.)
	    IF(XTEMP.LT..5)THEN
	      DO J=1,3
	        X(J,I)=X(J,I)+RA(J)
	      ENDDO
	    ELSE
	      DO J=1,3
	        X(J,I)=X(J,I)+RB(J)
	      ENDDO
	    ENDIF
	    wxt=wxt*wnxt
	  ENDDO
	  SR1A2=0
	  SR2B2=0
	  SR12=0
	  DO J=1,3
	    SR1A2=SR1A2+(X(J,1)-RA(J))**2
	    SR2B2=SR2B2+(X(J,2)-RB(J))**2
	    SR12=SR12+(X(J,1)-X(J,2))**2
	  ENDDO
	  EXARG=-ALPHA*(SR1A2+SR2B2)-BETA*SR12
	  F=EXP(EXARG)  
	  FSW=F/WXT
	  SUM=SUM+FSW
	  SUM2=SUM2+FSW*FSW
	ENDDO
	SUM2=SUM2/NMC
	SUM=SUM/NMC
	ERR=SQRT((SUM2-SUM*SUM)/NMC)
	PRINT*,' NMC=',NMC
	PRINT*,' THE NUMBER OF ELECTRONS IS',NUP
	PRINT*,' INTEGRAL IS ',SUM,' +- ',ERR
	ANAL=AMOLN(ALPHA,BETA,RA,RB)
	PRINT*,'AINTEGRAL IS ',ANAL,' RES=',(SUM-ANAL)/ERR
	STOP 
	END
C$INCLUDE RANDOM.FOR
C$INCLUDE SETUP.FOR
C$INCLUDE XNFIND
C$INCLUDE HFUNS
C$INCLUDE XNEFIN