#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++){ cout << (c == '*' ? a[i]*b[j] : a[i]+b[j]) << (j == m-1 ? "\n" : " "); } } return 0; }