#include using namespace std; using ll=long long; #define rep2(i, a, n) for(int i = (a); i < (n); i++) #define rep(i, n) rep2(i,0,n) int main(){ cin.tie(nullptr);ios_base::sync_with_stdio(false); int n,m;cin>>n>>m; int b[m],a[n]; char op; cin>>op;rep(i,m)cin>>b[i]; rep(i,n)cin>>a[i]; rep(i,n){ rep(j,m){ j!=n?cout<<(op=='+'?b[j]+a[i]:b[j]*a[i])<<" ":cout<<(op=='+'?b[j]+a[i]:b[j]*a[i]); } cout<