Three ones in a row#4054

Three ones in a row

1 segundo
64 megabytes
Muy fácil

Given a number , find the number of sequences composed of zeros and ones, each of length , where no three consecutive ones appear.

Entrada

The input consists of a single natural number , with a maximum value of .

Salida

Output the total number of such sequences. It is guaranteed that the result will not exceed 2^{31}-1.

Ejemplos

Ejemplo 1

Loading
Loading