#include using namespace std; using LL = long long; using ULL = unsigned long long; #define rep(i,n) for(int i=0; i<(n); i++) int main() { int H, W; scanf("%d%d", &H, &W); char op; scanf(" %c", &op); LL X[100], Y[100]; rep(i, W) scanf("%lld", &X[i]); rep(i, H) scanf("%lld", &Y[i]); if (op == '+') { rep(y, H) { rep(x, W - 1) { printf("%lld ", X[x] + Y[y]); } printf("%lld\n", X[W - 1] + Y[y]); } } if (op == '*') { rep(y, H) { rep(x, W - 1) { printf("%lld ", X[x] * Y[y]); } printf("%lld\n", X[W - 1] * Y[y]); } } return 0; }