Under construction

Still being built. Things may change

Pirate Code

Time limit2sMemory limit1024 MB

Summary
For each length k up to n, sum the decoded values of all binary codes of length k under Fibonacci pirate splitting, modulo 10^9+7.
Level

Hard8 of 10

Topics
Dynamic programming, Combinatorics, String
Solved
No attempts yet

Statement

Captain Marrrtina and her pirate crew spent three months searching for the long lost treasure of the most famous Italian pirate, and finally dug up a chest full of gold. To unlock the chest, she needs a secret combination. It is described in a message in a bottle next to the chest.

The message says:

So that only the most worthy pirate can open the chest, the combination is the solution to the following puzzle. A binary sequence ss of length aa in which the only pair of consecutive ones is at the end of the sequence is a pirate representation of a number xx if

∑i=0a−2s[i]⋅Fib[2+i]=x\sum_{i=0}^{a-2} s[i] \cdot Fib[2+i] = x

where Fib[x]Fib[x] denotes the xx-th Fibonacci number. Fibonacci numbers are defined by Fib[1]=1Fib[1] = 1, Fib[2]=1Fib[2] = 1, and Fib[y]=Fib[y−1]+Fib[y−2]Fib[y] = Fib[y-1] + Fib[y-2] for each y>2y > 2.

For example, 11p=111_p = 1, 011p=2011_p = 2, 1010011p=171010011_p = 17, where pp denotes a pirate representation of a number.

A pirate code is a binary sequence (with no restriction on consecutive ones) that represents a sequence of positive integers. To read it, split it into as many parts as possible, where each part is a pirate representation of some number. A suffix that is not a pirate representation of any number may be left over, and it is discarded. The integers of the parts are then written in order. For example, split 0111101011010101111010110101 into 011|11|01011|0101. The last part is not a pirate representation, so it is dropped, leaving 011|11|01011, which reads as the sequence 22, 11, 77.

The value of a pirate code is the sum of the values of the decoded sequence of positive integers. The value of the code above is 1010.

My favourite number PP is the sum of the values of all pirate codes of length kk. Since that number may be large, the combination to the chest is the remainder of PP modulo 109+710^9 + 7.

If Marrrtina does not open the chest, her crew will not consider her worthy and will make her walk the plank.

  • Leonarrrdo da Pisa

Input

A single line contains a positive integer n≤5000n \le 5000.

Output

Print nn numbers on a single line, where the kk-th number is the answer to the puzzle for codes of length kk.

Clarification

Codes of length 11 are 00 and 11, and both have value 00.

Code 1111 has value 11, and all other codes of length 11 have value 00.

Code 11111111 has value 22, and code 00110011 has value 33.

Examples1

  1. Example 1

    Input
    4
    
    Expected output
    0 1 4 16