#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int n,m;
int a[55][6];
while (cin>>n>>m)
{
for (int i=0;i<n;i++)
{
for (int j=0;j<m;j++)
{
cin>>a[i][j];
}
}
for (int i=0;i<n;i++)
{
int sum=0,;
double average=0;
for (int j=0;j<m;j++)
{
sum+=a[i][j];
}
average=sum/(m*1.0);
if (i==0)
{
cout<<fixed<<setprecision(2)<<average;
}
else
cout<<" "<<fixed<<setprecision(2)<<average;
}
cout<<endl;
double average1[5];
for (int j=0;j<m;j++)
{
int sum1=0;
for (int i=0;i<n;i++)
{
sum1+=a[i][j];
}
average1[j]=sum1/(n*1.0);
if (j==0)
{
cout<<fixed<<setprecision(2)<<average1[j];
}
else
cout<<" "<<fixed<<setprecision(2)<<average1[j];
}
cout<<endl;
int count=0;
for (int i=0;i<n;i++)
{
int x=0;
for (int j=0;j<m;j++)
{
if (a[i][j]>=average1[j])
{
x++;
}
}
if (x==m)
{
count++;
}
}
cout<<count<<endl<<endl;
}
return 0;
}