#include using namespace std; using pii = pair; using ll = long long; #define rep(i, j, n) for(int i = j; i < (int)(n); i++) const ll MOD = 1000000007; const ll INFL = (1LL << 60); const int INFI = (1 << 30); int main() { int N, M; cin >> N >> M; string op; cin >> op; vector A(N), B(M); rep(i, 0, M) cin >> B.at(i); rep(i, 0, N) cin >> A.at(i); if (op == "+") { rep(i, 0, N) { rep(j, 0, M - 1) { cout << A.at(i) + B.at(j) << " "; } cout << A.at(i) + B.at(M - 1) << endl; } } else { rep(i, 0, N) { rep(j, 0, M - 1) { cout << A.at(i) * B.at(j) << " "; } cout << A.at(i) * B.at(M - 1) << endl; } } }