#C12422. Tribonacci Sequence Calculator

    ID: 41848 Type: Default 1000ms 256MiB

Tribonacci Sequence Calculator

Tribonacci Sequence Calculator

In this problem, you are required to compute the Tribonacci number at a given index n. The Tribonacci sequence is defined as follows:

\(T(0)=0, \quad T(1)=1, \quad T(2)=1,\)

and for \(n > 2\):

\(T(n)=T(n-1)+T(n-2)+T(n-3)\)

Your task is to calculate \(T(n)\) efficiently. Make sure your solution reads the input from stdin and writes the output to stdout.

inputFormat

The input consists of a single integer n which is the index in the Tribonacci sequence.

You should read from stdin.

outputFormat

Output the nth Tribonacci number to stdout.

## sample
0
0