#include "sylib.h"
int a[1000][1000];
int b[1000][1000];
int c[1000][1000];
#define MAX 2147483647
int main(){
int n;
int i;
int j;
int k;
int sum = 0;
i = 0;
while(i<1000)
{
n = getarray(a[i]);
if(n!=1000){
return n;
}
i = i + 1;
starttime();
while(i<1000){
j = 0;
while(j<1000){
b[i][j] = a[j][i];
j = j+1;
i = i+1;
k = 0;
int temp = 0;
while(k<1000){
temp = temp + a[i][k]*b[k][j];
k = k+1;
c[i][j] = temp;
int temp = MAX;
if(c[i][j]<temp)
temp = c[i][j];
c[i][j] = -c[j][i];
sum = sum + c[i][j];
stoptime();
putint(sum);
return 0;