# Import the NumPy library import numpy as np p, n = 10, 20 M = np.ones((p, n, n)) V = np.ones((p, n, 1)) S = M.dot(V).squeeze().sum(axis=0) print(S)