ppp

Trivial welcome crypto.

m = [[p,p,p,p], [0,m1,m1,m1], [0,0,m2,m2],[0,0,0,1]]

# add padding
for i in range(4):
    for j in range(4):
        m[i][j] *= getPrime(768)

m = matrix(Zmod(p*q), m)

c = m^e

print("n =", n)
print("e =", e)
print("c =", list(c))

The determinant of the resulting matrix is , so gcd factors n, and then the multiplicative order of 4×4 matrices over I think always divides (TODO: look it up) and so with that the approach is the same as if it was regular RSA.