A = n * Quotient + Remainder
10 * A + 1 = 10 * (n * Quotient + Remainder) + 1
= (10 * n * Quotient + (10 * Remainder + 1) / n ) + (10 * Remainder + 1) % n
-------------------------------------------------------------------------------------------------------------------