#include using namespace std; typedef long long ll; #define mod 1000000007 #define all(x) (x).begin(), (x).end() #define pb push_back const long double PI = acos(-1); ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;} ll lcm(ll a,ll b){return a / gcd(a,b) * b;} ll GetDigit(ll num) {return log10(num)+1;} int main(){ ll n, m; cin >> n >> m; vector a(n), b(m); char c; cin >> c; for(ll i = 0; i < m; i++) cin >> b[i]; for(ll j = 0; j < n; j++) cin >> a[j]; for(ll i = 0; i < n; i++){ for(ll j = 0; j < m; j++){ if(j != n){ if(c == '*') cout << b[j] * a[i] << " "; else cout << b[j] + a[i] << " "; }else{ if(c == '*') cout << b[j] * a[i]; else cout << b[j] + a[i]; } } cout << endl; } return 0; }