#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair P; typedef pair Pid; typedef pair Pdi; typedef pair Pl; typedef pair> PP; const double PI = 3.1415926535897932; // acos(-1) const double EPS = 1e-15; const int INF = 1001001001; const int mod = 1e+9 + 7; #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) #define chadd(x, y) x = (x + y) % mod int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; char op; cin >> n >> m >> op; vector b(m); for(int i = 0; i < m; ++i) cin >> b[i]; vector a(n); for(int i = 0; i < n; ++i) cin >> a[i]; vector> res(n, vector(m, 0)); if(op == '+'){ for(int i = 0; i < n; ++i){ for(int j = 0; j < m; ++j){ res[i][j] = a[i] + b[j]; } } } else{ for(int i = 0; i < n; ++i){ for(int j = 0; j < m; ++j){ res[i][j] = a[i] * b[j]; } } } for(int i = 0; i < n; ++i){ for(int j = 0; j < m; ++j){ cout << res[i][j]; cout << ((j == m - 1) ? "\n" : " "); } } }