#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define F1(x,y,z) for(int x=y;xz;x--) #define F4(x,y,z) for(int x=y;x>=z;x--) #define pb push_back #define LL long long #define co complex #define MAX 100005 #define AMAX 1500 #define MOD 1000000007 #define f(c,d) ((1<<(c))*(d)) using namespace std; int n,m; double x[1005][1005],y[2][1005],ta; int main(){ while(scanf("%d%d",&n,&m)==2){ F1(a,0,m)y[0][a]=y[1][a]=0; F1(a,0,n){ ta=0; F1(b,0,m){ scanf("%lf",&x[a][b]); ta+=x[a][b]; } F1(b,0,m){ x[a][b]/=ta; y[0][b]+=x[a][b]; y[1][b]+=x[a][b]*x[a][b]; } } ta=0; F1(a,0,m)ta+=y[0][a]+y[0][a]*y[0][a]-y[1][a]; printf("%.2lf\n",ta); } //system("pause"); return 0; }