PROGRAM mat
  IMPLICIT NONE

  integer :: N
  DOUBLE PRECISION, allocatable :: a(:,:), b(:,:), c(:,:)

  PRINT *, "Dose N"
  read *, N
  
  allocate(a(N,N))
  allocate(b(N,N))
  allocate(c(N,N))
  DO i=1,N
     DO j=1,N
        a(i,j) = (i+j)/3d0
        b(i,j) = 2*i-j/3d0
     END DO
  END DO

  DO i=1,N
     DO j=1,N
        c(i,j) = 0d0
        DO k=1,N
           c(i,j) = c(i,j) + a(i,k)*n(k,j)
        END DO
     END DO
  END DO
     
END PROGRAM mat
