program main implicit none integer*8::N,i,Z real*8::A,B,C integer*8::XY real*8,allocatable::AB(:,:) read *,N allocate(AB(2,N)) read *,AB do i=1,N A = AB(1,i) B = AB(2,i) C = B*log10(A) Z = C XY = 10**(C-DBLE(Z)+1) print '(i0," ",i0," ",i0)',XY/10,MOD(XY,10) ,Z end do end program main