Want to use some of the algebra rules of log's:
log(a)-log(b)= log(a/b),
so log(P/N) - log(M/N) = log( P/N:M/N) = log(P/M),
Then: 8-5 = log(P/M), log(P/M)=3.
If log here means natural logarithm (base e), then P/M = e^3,
If log here means basis 10, decimal logarithm, then P/M = 10^3 = 1000.