p=qx+4x−5 would be the answer to your problem. Math Papa is a good website to use for alegebra or math
P = x (4 + q) - 5
This is the simplified version of the problem given