Even more sequences of bits

Please compute the number of different sequences of length n, made up of
only zeroes and ones, and with no more than two consecutive ones.

Input

Input consists of several cases, each with a natural number n between 0
and 10⁹.

Output

For every case, print the number of different sequences of n bits that
do not have more than two consecutive ones, modulo 10⁹ + 7.

Hint

A matrix can be powered to a natural number x with only Θ(log x)
products of matrices.

Problem information

Author: Pol Mauri

Generation: 2026-01-25T12:01:35.030Z

© Jutge.org, 2006–2026.
https://jutge.org
