#include <cstdio>
#include <algorithm>
#include <numeric>
#include <cstring>
using namespace std;
int a[71][7];
int avg1[71],avg2[7];
int main()
{
    int n,m;
    while(~scanf("%d%d",&n,&m))
    {
        memset(avg1,0,sizeof(avg1));
        memset(avg2,0,sizeof(avg2));
        for(int i=0; i<n; i++)
            for(int j=0; j<m; j++)
                scanf("%d",&a[i][j]),avg1[i]+=a[i][j],avg2[j]+=a[i][j];
        for(int i=0; i<n-1; i++)
            printf("%.2lf ",1.0*avg1[i]/m);
        printf("%.2lf\n",1.0*avg1[n-1]/m);
        for(int i=0; i<m-1; i++)
            printf("%.2lf ",1.0*avg2[i]/n);
        printf("%.2lf\n",1.0*avg2[m-1]/n);
        int ans=0;
        for(int i=0; i<n; i++)
        {
            bool flag=true;
            for(int j=0; j<m; j++)
                if(a[i][j]*n<avg2[j])
                    flag=false;
            ans+=flag;
        }
        printf("%d\n\n",ans);
    }
    return 0;
}
