#include using namespace std; #define rep(i, n) for(int i=0; i<(int)(n); i++) #define rep1(i, n) for(int i=1; i<(int)(n); i++) typedef long long ll; typedef vector vi; typedef vector wi; typedef vector vl; typedef vector wl; int main(){ cin.tie(0); ios::sync_with_stdio(false); int n, m; char op; cin >> n >> m >> op; vl a(n), b(m); rep(i, m)cin >> b[i]; rep(i, n)cin >> a[i]; wl c(n, vl(m)); if(op=='+')rep(i, n)rep(j, m)c[i][j]=a[i]+b[j]; else rep(i, n)rep(j, m)c[i][j]=a[i]*b[j]; rep(i, n){ rep(j, m-1)cout << c[i][j] << " "; cout << c[i][m-1] << endl; } return 0; }