Under construction

Still being built. Things may change

Slightly smarter Roebeot and slightly better looking Sanya

Time limit1sMemory limit128 MB

Summary
Write N as a sum of non-consecutive Fibonacci numbers F(1)=1, F(2)=2, maximizing the number of terms, or report -1.
Level

Medium7 of 10

Topics
Greedy, Math, Number theory, Implementation
Solved
No attempts yet

Problem

*This problem has nothing to do with any real person.*

Long ago there lived a man named Sanya. Sanya had a friend named Roebeot. The two looked very much alike, but Roebeot was said to be a little smarter and Sanya a little better looking. Roebeot was stuck at 500 points in a game called Ovorwatch, which put him in the top 100.00%. Sanya liked to tease him about it. Roebeot got angry and offered a bet: if he ever climbed out of 500 points in Ovorwatch, Sanya would have to solve the problems Roebeot sets for the rest of his life. Sanya took the bet, sure that it would never happen.

And then it happened.

Roebeot pushed his score all the way into the 600s, and the bet left Sanya solving Roebeot's problems forever. Here is the problem Roebeot set. Take the natural number he gives you and write it as a sum of non-consecutive Fibonacci numbers. The Fibonacci sequence here is defined by F(1)=1F(1) = 1, F(2)=2F(2) = 2, F(n+2)=F(n+1)+F(n)F(n+2) = F(n+1) + F(n). Non-consecutive means the indices of the chosen terms are never neighbours. Foolish Sanya works the Fibonacci sequence out by hand, it takes forever, and he is going out of his mind. Clever Roebeot teased him for not even managing that much, and Sanya sulked. Write a program that takes the work off sulking Sanya's hands.

Input

The first line contains a natural number NN. (1≤N<10181 \le N < 10^{18})

Output

If NN can be written as F(i1)+F(i2)+⋯+F(ik)F(i_1) + F(i_2) + \dots + F(i_k) with i1<i2<⋯<iki_1 < i_2 < \dots < i_k and no two neighbouring indices consecutive, that is ij+1−ij≥2i_{j+1} - i_j \ge 2 for every jj, print kk on the first line and print F(i1),F(i2),…,F(ik)F(i_1), F(i_2), \dots, F(i_k) separated by spaces on the second line. Otherwise print −1-1 on the first line. If several such representations exist, print the one with the most terms.

Examples5

  1. Example 1

    Input
    10
    
    Expected output
    2
    2 8
    
  2. Example 2

    Input
    1
    
    Expected output
    1
    1
    
  3. Example 3

    Input
    2
    
    Expected output
    1
    2
    
  4. Example 4

    Input
    3
    
    Expected output
    1
    3
    
  5. Example 5

    Input
    4
    
    Expected output
    2
    1 3