#!/usr/bin/env python3 # %% import numpy as np stdin = open(0) # %% N, M = map(int, stdin.readline().split()) op = stdin.read(1) # %% AB = np.fromstring(stdin.read(), np.int64, sep=' ') # %% B = AB[:M] A = AB[M:] # %% f = np.add if op == '+' else np.multiply C = f.outer(A, B) # %% print('\n'.join(' '.join(row) for row in C.astype(str))) # %%