#include #include #define REP(i, n) for (int i = 0; i < n; i++) typedef long long ll; using namespace std; int main() { int N, M; cin >> N >> M; string op; cin >> op; vector yoko; REP(i, M) { ll j; cin >> j; yoko.push_back(j); } REP(i, N) { ll k; cin >> k; REP(j, M) { if (op == "*") cout << k * yoko.at(j); else if (op == "+") cout << k + yoko.at(j); if (j < M - 1) cout << " "; } cout << endl; } return 0; }