Over 3 years after asking the question I found the solution. I have included it as an answer.
I have an expression with modulus in it that needs to
Using @Subhi Anyman answer as reference (with slight modifications), if we have this equation to reverse the modulus operation
(var1 + var2) mod num = Res
then to obtain var1, we use the following
var1 = num - ((Res - var2) * -1)
if (var1 > num) {
var1 = var % num; // making sure var1 is in range of 'num'
}