You will be given three integers a, b, m. Print ( ab ) mod m. There will be 30 test cases at most in an input file. In each case a and b both will be integer numbers of at most 105 digits.
There will be multiple test cases in each input file . Each line of the input file will contain three integer numbers a , b and m (1 ≤ m ≤ 1.5*109).
a and b both will be integer numbers of at most 105 digits.
Input will be terminated when a = 0 , b = 0 and m = 0. This line should not be processed.
Each input file contains 30 test cases at most.
For each case, print ( ab ) mod m in a new line.
Input | Output |
---|---|
7 2 11 4 2 3 19 1 5 0 0 0 | 5 1 4 |