def cumprod(self, a):
    p = self.mod
    l = len(a)
    sql = int((np.sqrt(l) + 1))
    a = np.resize(a, (sql ** 2)).reshape(sql, sql)
    for i in range((sql - 1)):
        a[:, (i + 1)] *= a[:, i]
        a[:, (i + 1)] %= p
    for i in range((sql - 1)):
        a[(i + 1)] *= a[(i, (- 1))]
        a[(i + 1)] %= p
    return np.ravel(a)[:l]
def cumprod(self, a):
    p = self.mod
    l = len(a)
    sql = int((np.sqrt(l) + 1))
    a = np.resize(a, (sql ** 2)).reshape(sql, sql)
    for i in range((sql - 1)):
        a[:, (i + 1)] *= a[:, i]
        a[:, (i + 1)] %= p
    for i in range((sql - 1)):
        a[(i + 1)] *= a[(i, (- 1))]
        a[(i + 1)] %= p
    return np.ravel(a)[:l]