#include #include #define rep(i,n) for(int i = 0; i < n; i++) #define srep(i,a,b) for(int i = a; i < b; i++) #define all(A) (A).begin(),A.end() #define MOD 1000000007 using namespace std; using ll = long long; using P = pair; using Graph = vector>; int main(void){ int n,m; cin >> n >> m; char op; cin >> op; vector A(n),B(m); rep(i,m) cin >> B[i]; rep(i,n) cin >> A[i]; rep(i,n){ rep(j,m){ cout << (op == '+' ? A[i]+B[j] : A[i]*B[j]) << (j == m-1 ? "\n" : " "); } } }