Divisors [0]
Let's consider the string of all natural numbers:
We'd like to find the sum of the first values of this sequence, although that alone is a bit boring (how would we do this?)
Instead, we'd like to find the sum, only after doing a simple operation to the individual sequence values - taking their value modulo some .
For example, for , , the sequence of the first 5 elements would be: , and the total sum would be 7.
Input
Input will contain two space-separated integers and , mirroring the definition from the statement
Output
Output a single integer representing the sum of the first elements modulo .
Constraints
Example
Input
5 4
Output
7
Comments