LogiQuest

264. Binary Strings Without Consecutive Ones

EasyDynamic ProgrammingFibonacci

Count binary strings of length n with no two consecutive 1s. Print modulo 10⁹ + 7.

Input format

A single integer n.

Output format

The count mod 10⁹ + 7.

Example 1

Input

2

Output

3

Example 2

Input

3

Output

5

Constraints

1 ≤ n ≤ 10⁶

Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.

Loading the MyLoginn IDE…