#P10496. Bob's Luckiest Number
Bob's Luckiest Number
Bob's Luckiest Number
Chinese people often regard the digit '8' as lucky, and Bob is no exception. Bob also has his own lucky number L. He wants to create his luckiest number, which is defined as the smallest positive integer that:
- Is a multiple of L, and
- Consists solely of the digit '8'.
This number can also be represented in a mathematical form as follows:
\( N = \sum_{i=0}^{k-1} 8 \times 10^i \)
where k is the number of digits in N. If no such number exists, output -1.
inputFormat
Input consists of a single integer L (1 ≤ L ≤ 500) on one line, representing Bob's lucky number.
outputFormat
Output the smallest number composed entirely of the digit '8' that is a multiple of L. If no such number exists, output -1.
sample
8
8