#AT1144. D - Small Multiple

D - Small Multiple

当前没有测试数据。

D - Small Multiple

Score : $700$ points

Problem Statement

Find the smallest possible sum of the digits in the decimal notation of a positive multiple of $K$.

Constraints

  • $2 \leq K \leq 10^5$
  • $K$ is an integer.

Input

Input is given from Standard Input in the following format:

KK

Output

Print the smallest possible sum of the digits in the decimal notation of a positive multiple of $K$.


6
3

$12=6×2$ yields the smallest sum.


41
5

$11111=41×271$ yields the smallest sum.


79992
36