#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long int lint; typedef pair IP; typedef pair LLP; typedef pairCP; #define rep(i, n) for (int i = 0; i < n; i++) #define repr(i, n) for (int i = n; i >= 0; i--) #define sort(v) sort((v).begin(), (v).end()) #define reverse(v) reverse((v).begin(), (v).end()) #define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge) #define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge) #define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge) #define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge) const lint MOD = pow(10, 9) + 7; int main() { lint N, M; cin >> N >> M; char op; cin >> op; vectorB(M); rep(i, M) { cin >> B[i]; } vectorA(N); rep(i, N) { cin >> A[i]; } rep(i, N) { rep(j, M) { if (op == '+') { cout << A[i] + B[j] << ' '; } else { cout << A[i] * B[j] << ' '; } } cout << endl; } }