#include using namespace std; using ll = long long; using PII = std::pair; using PLL = std::pair; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) const int mod = 1e9 + 7; ll cal(int r, int c, char op) { if (op == '*') return r * c; if (op == '+') return r + c; return 0; } int main() { #ifdef DEBUG cout << "DEBUG MODE" << endl; ifstream in("input.txt"); //for debug cin.rdbuf(in.rdbuf()); //for debug #endif int h, w, r; ll d; char op; cin >> h >> w >> op; vector c(w); rep(i, w) cin >> c[i]; rep(i, h) { cin >> r; rep(j, w) { d = cal(c[j], r, op); if (j == w - 1) cout << d << endl; else cout << d << " "; } } return 0; }