#include<cstdio> #include<iostream> #include<algorithm> #include<cmath> using namespace std; int n; struct Matrix{ long long a,b,v[105][105]; }A,B; Matrix operator *(Matrix A,Matrix B){ Matrix C; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ for(int k=1;k<=n;k++){ C.v[i][j]+=(A.v[i][k]%1000000007)*(B.v[k][j]%1000000007); C.v[i][j]%=1000000007; } } } return C; } int main(){ scanf("%d",&n); for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ scanf("%lld",&A.v[i][j]); } } B=A*A; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ printf("%lld ",B.v[i][j]); } printf(" "); } return 0; }