/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
Scanner in
= new Scanner
(System.
in);
int l = in.nextInt();
int m = in.nextInt();//Количество строк и столбцов.
double q[][] = new double [l][m];//Данная матрица.
/*for(int i=0; i<l; i++){
for(int j=0; j<m; j++){
System.out.print(q[i][j]+" ");
}
System.out.println("");
}*/
double sum[] = new double [l];
double sr[] = new double [l];
for (int i=0; i<l; i++){
sum[i]=0;
}
for (int i=0; i<l; i++) {
for (int j=0; j<m; j++){
q[i][j] = in.nextDouble();//Ввод элементов матрицы.
sum[i]+=q[i][j];//Сумма элементов каждой строки.
}
sr[i]=sum[i]/m;//Среднее арифметическое каждой строки.
}
for (int i=0; i<l; i++){
for (int j=0; j<m; j++){
q[i][j]-=sr[i];//Вычитание среднего арифметического из каждого элемента матрицы.
System.
out.
print(q
[i
][j
]+" ");//Вывод итоговой матрицы. }
}
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVNjYW5uZXIgaW4gPSBuZXcgU2Nhbm5lcihTeXN0ZW0uaW4pOwoJCQoJCWludCBsID0gaW4ubmV4dEludCgpOwoJCWludCBtID0gaW4ubmV4dEludCgpOy8v0JrQvtC70LjRh9C10YHRgtCy0L4g0YHRgtGA0L7QuiDQuCDRgdGC0L7Qu9Cx0YbQvtCyLg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