WA in 2/9 test cases Linear Congruence

I m getting wrong answer in only 2 test cases and 7 test cases are correct
Please look at my code what I am missing!!

@rkrishna
I think there is mistakes in testcases. Let me ask the concerned person

@rkrishna
One of the testcase was wrong, We have deleted that testcase. You code is iving wrong ans for this
2
32416189381 5
2 3
ans should be " 32416189383"

Yes got the mistake!
we should define modular multiplication, because direct multiplication causes overflow.
Thanks

@rkrishna
Great mark it as resolved.