AtCoder Beginner Contest 077
D
Small Multiple
AtCoder
⌀ 2457
原题
← C→
翻译中…

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:

翻译中…

K

翻译中…

Output

翻译中…

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

翻译中…

样例

Input #1
6
Output #1
3
$12=6×2$ yields the smallest sum.
Input #2
41
Output #2
5
$11111=41×271$ yields the smallest sum.
Input #3
79992
Output #3
36
题目信息
题号
arc084_b
时间限制
2 s
内存限制
256 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。