	subroutine wgtint(begin,end,num,val,wgt)
c
c	return values and weights for gaussian integrals
c	num=1 means return value not integral
c	note num forced to be a multiple of 8 if greater than 8
c
	dimension val(1),wgt(1),x(35),w(35),list(8)
c
c
	data x/.2113248654,0.7886751346,
& .1127016654,0.5,0.8872983346,
& 0.0694318442,0.3300094782,0.6699905218,0.9305681558,
& 0.046910077,0.2307653449,0.5,0.7692346551,0.9530899230,
& 0.0337652429,0.1693953068,0.380690407,0.619309593,0.8306046932,
& 0.9662347571,
& 0.0254460438,0.1292344072,0.2970774243,0.5,0.7029225757,
& 0.8707655928,0.9745539562,
& 0.0198550718,0.1016667613,0.237233795,0.4082826788,0.5917173212,
& .762766205,.8983332387,.9801449282/
c
	data w/.5,.5,
& .2777777778,.4444444444,.2777777778,
& .1739274226,.3260725774,.3260725774,.1739274226,
& .1184634425,.2393143352,.2844444444,.2393143352,.1184634425,
& .0856622462,.1803807865,.2339569673,.2339569673,.1803807865,
& .0856622462,
& .0647424831,.1398526957,.1909150253,.2089795918,.1909150253,
& .1398526957,.0647424831,
& .0506142681,.1111905172,.1568533229,.1813418917,.1813418917,
& .1568533229,.1111905172,.050614281/
c
	data list/0,0,2,5,9,14,20,27/
c
	if (num.ge.1) goto 11
	print 131,num
131	format(' error in wgtint   num='i5)
	call abort
11	if(num.eq.1) go to 100
	if(num.gt.8) go to 200
c
c	num=2,8  is direct use of gauss
	diff=(end-begin)
	ist=list(num)
	do 50 i=1,num
	j=ist+i
	val(i)=begin+diff*x(j)
50	wgt(i)=abs(diff)*w(j)
	return
c
c	simply value of function at midpoint
100	val(1)=.5*(begin+end)
	wgt(1)=abs(end-begin)
	if (wgt(1).le.1.e-20) wgt(1)=1.
	return
c	reset  num to next lower multiple of 8
200	ist=list(8)
	m=num/8
	num=8*m
c
	diff=(end-begin)/m
	k=1
	do 400 i=1,m
	b=begin+diff*(i-1)
	do 300 j=1,8
	jj=ist+j
	val(k)=b+diff*x(jj)
	wgt(k)=abs(diff)*w(jj)
300	k=k+1
400	continue
	return
c
	end
