#include<iostream> #include<iomanip> using namespace std; int main() { int n,m,i,j; double a[50][6]; double b[6]; while(cin>>n>>m) { double x=0,y=0; int t=0,flag=0; for(i=0;i<n;i++) { for(j=0;j<m;j++) cin>>a[i][j]; } for(i=0;i<n-1;i++) { for(j=0;j<m;j++) {x+=a[i][j];} x=x/(double)m; cout<<fixed<<setprecision(2)<<x<<" "; x=0; } for(j=0;j<m;j++) {x+=a[n-1][j];} x=x/(double)m; cout<<fixed<<setprecision(2)<<x<<endl; for(j=0;j<m-1;j++) { for(i=0;i<n;i++) {y+=a[i][j];} b[j]=y/(double)n; cout<<fixed<<setprecision(2)<<b[j]<<" "; y=0; } for(i=0;i<n;i++) {y+=a[i][m-1];} b[m-1]=y/(double)n; cout<<fixed<<setprecision(2)<<b[m-1]<<endl; y=0; for(i=0;i<n;i++) { for(j=0;j<m;j++) { if(a[i][j]>=b[j]) flag++; } if(flag==m) t++; flag=0; } cout<<t<<endl<<endl; } return 0; }