#P2841. A*B Problem

A*B Problem

Description

Given a number AA, you need to output the smallest number BB such that the result of A×BA \times B contains only digits 0 and 1.

Input Format

A positive integer AA.

Output Format

The positive integer BB and the result of A×BA \times B, separated by a single space.

6
185 1110

Hint

Sample explanation: 6×185=11106 \times 185 = 1110.

For 30% of the testdata, 0<A<200 < A < 20. For 50% of the testdata, 0<A<1000 < A < 100. For 70% of the testdata, 0<A<10000 < A < 1000. For 100% of the testdata, 0<A<1040 < A < 10^4.

Translated by ChatGPT 5