#include #include #include #include #include using namespace std; const int N = 1050; double map[N][N]; int n,m; int getint() { int res=0; char ch=getchar(); while((ch<'0' || ch>'9') && ch!='-') ch=getchar(); bool fan=0; if(ch=='-') { fan=1; ch=getchar(); } while('0'<=ch && ch<='9') { res=res*10+ch-'0'; ch=getchar(); } if(fan) res=-res; return res; } void f() { int i,j; m=getint(); for(i=1;i<=n;i++) { for(j=1;j<=m;j++) map[i][j]=getint(); } double ans=0.0; for(i=1;i<=n;i++) { double now=0.0; for(j=1;j<=m;j++) now+=map[i][j]; for(j=1;j<=m;j++) { double t=map[i][j]/now; map[i][j]=t; ans+=t*(1.0-t); } } for(j=1;j<=m;j++) { double now=0.0; for(i=1;i<=n;i++) now+=map[i][j]; ans+=now*now; } printf("%.2f\n",ans); } int main() { while(scanf("%d",&n)!=EOF) f(); return 0; }