	 implicit none
	
	 real*8 q(3,3),q1(3,3),dq(3,3),q_inv(3,3),tmjd,s
	 integer an, mois, jour, nh, nm,i,k,l
 	
	 open(unit=77,file='fort.77',status='old')
	
	 do i=1,100000 
	
	 read(77,1000,end=10)
     &                tmjd,an, mois, jour, nh, nm, s, 
     &  		     q(1,1),q(1,2),q(1,3),
     &  		     q(2,1),q(2,2),q(2,3),
     &  		     q(3,1),q(3,2),q(3,3)		

         if (i.ge.2) then
	  ! calcul de dq : q = dq q1
	  ! dq = q q1^{-1}      
	    
	     call transmat(q1, q_inv, 3, 3)
	     call mulmat(q,q_inv,dq,3,3,3)
	
	 write(78,1010)
     &                tmjd, 
     &  		     dq(1,1),dq(1,2),dq(1,3),
     &  		     dq(2,1),dq(2,2),dq(2,3),
     &  		     dq(3,1),dq(3,2),dq(3,3)		
          endif
	     	     
	     do l=1,3
	     do k=1,3
	     q1(l,k) = q(l,k)
	     enddo
	     enddo

           enddo
	
10	  continue
	
1000       format(f22.13,i6,i3,i3,i3,i3,f18.9,3f22.12,3f22.12,3f22.12)	
1010       format(f22.13,3f22.12,3f22.12,3f22.12)	
	   
	   end

           include "trans.f" 
