	SUBROUTINE FORTRI(A,B,C,XXX,YYY,ZZZ,ALP)
	IMPLICIT REAL*8(A-Z)
	PI=3.141592653589793D0
	X=DACOS(DCOS(A)*DCOS(C)+DSIN(A)*DSIN(C)*DCOS(B))
	Z1=DSIN(C)*DSIN(B)
	Z2=DSIN(A)*DCOS(C)-DCOS(A)*DSIN(C)*DCOS(B)
	Z=DATAN(Z1/Z2)
	DEX=DSIN(X)*Z2
	IF(DEX.LT.0.D0) Z=Z+PI
	Z1=DSIN(A)*DSIN(B)
	Z2=-DCOS(A)*DSIN(C)+DSIN(A)*DCOS(C)*DCOS(B)
	Y=DATAN(Z1/Z2)
	DEX=DSIN(X)*Z2
	IF(DEX.LT.0.D0) Y=Y+PI
	Y=Y+ALP
	XXX=X
	YYY=Y
	ZZZ=Z
	RETURN
	END
