#D11485. Small Multiple
Small Multiple
Small Multiple
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.
Examples
Input
6
Output
3
Input
41
Output
5
Input
79992
Output
36
inputFormat
Input
Input is given from Standard Input in the following format:
K
outputFormat
Output
Print the smallest possible sum of the digits in the decimal notation of a positive multiple of K.
Examples
Input
6
Output
3
Input
41
Output
5
Input
79992
Output
36
样例
41
5