#include using namespace std; int main() { int n, m; cin >> n >> m; char op; cin >> op; function f = [&](int64_t lhs, int64_t rhs) { if(op == '+') return lhs + rhs; return lhs * rhs; }; int64_t b[m]; for(int i = 0; i < m; ++i) cin >> b[i]; int64_t a[n]; for(int i = 0; i < n; ++i) cin >> a[i]; for(int i = 0; i < n; ++i) { for(int j = 0; j < m; ++j) { cout << f(a[i], b[j]) << (j == m - 1 ? "\n" : " "); } } return 0; }