Digit DP - Magic Number

I am not able to understand the use of modulo in this ques. Like how will it maintain the uniqueness ? Or what is the use of m ?

We need that condition na which says divisible by m. Please go through the problem statement again.
https://codeforces.com/problemset/problem/628/D
We are building the number digit by digit and maintaining mod side by side to know if condition is being satisfied or not.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.