       SUBROUTINE THOMAS(II,A,B,C,T,R)
       IMPLICIT REAL*8 (A-H,O-Z)
       DIMENSION A(1),B(1),C(1),T(1),R(1)
       DIMENSION BETA(201),S(201)
       REAL*8 M(201)
       BETA(1) = B(1)
       S(1) = R(1) 
       DO I = 2,II
         M(I) = A(I)/BETA(I-1)
         BETA(I) = B(I)-M(I)*C(I-1)
         S(I) = R(I)-M(I)*S(I-1)
       ENDDO
       T(II) = S(II)/BETA(II)
       DO I = II-1,1,-1
         T(I) = (S(I)-C(I)*T(I+1))/BETA(I)
       ENDDO
       RETURN
       END
    
