What is the version of the following sentence with correct punctuation?

Dqk can be replaced by qk1 for any q Thus the LHS of the above equation is nmk1
D(qk) can be replaced by q%(k-1) for any q. Thus the LHS of the above equation is (n+m)%(k-1).