Solved it, knowing an old math concept helped, did a Google search and got the values [writing the code to loop through the values for m,n was easier but felt someone must have computed them and posted on web].
Just wrote the code for cipher and used all possible characters and replaced using the encrypted value. Though I nearly sent it to the wrong address since it wasn't clear whether address contained the answer it self or answer%256. took ~30 mins [mostly to look up ord,chr and the solution on google].
final solution 12 lines python code, does not calculates a,b,c just the cipher and i/o.