CF894C Marco and GCD Sequence
Description
In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time.
When he woke up, he only remembered that the key was a sequence of positive integers of some length $ n $ , but forgot the exact sequence. Let the elements of the sequence be $ a_{1},a_{2},...,a_{n} $ . He remembered that he calculated $ gcd(a_{i},a_{i+1},...,a_{j}) $ for every $ 1
Input Format
The first line contains a single integer $ m $ ( $ 1
Output Format
If there is no solution, print a single line containing -1.
Otherwise, in the first line print a single integer $ n $ denoting the length of the sequence, $ n $ should not exceed $ 4000 $ .
In the second line print $ n $ integers $ a_{1},a_{2},...,a_{n} $ ( $ 1
Explanation/Hint
In the first example $ 2=gcd(4,6) $ , the other elements from the set appear in the sequence, and we can show that there are no values different from $ 2 $ , $ 4 $ , $ 6 $ and $ 12 $ among $ gcd(a_{i},a_{i+1},...,a_{j}) $ for every $ 1