#include <iostream>
using namespace std;
int main() {
int n, m;
cin >> n;
cin >> m;
if (n <= 0 || n > 5 || m <= 0 || m > 5) {
return 1;
}
int matrix1[5][5], matrix2[5][5];
float avg[5][5];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> matrix1[i][j];
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> matrix2[i][j];
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
avg[i][j] = (matrix1[i][j] + matrix2[i][j]) / 2.0;
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cout << avg[i][j] << " ";
}
cout << endl;
}
return 0;
}