#K33062. Modified Fibonacci Sequence
Modified Fibonacci Sequence
Modified Fibonacci Sequence
You are given a modified Fibonacci sequence defined as follows:
The first three terms are given as:
- a(1) = 0
- a(2) = 1
- a(3) = 1
For all n > 3, the n-th term is defined by the recurrence relation:
$$a(n)=a(n-3)+a(n-2)+a(n-1)$$
Your task is to compute the n-th term of this sequence.
inputFormat
The input consists of a single integer n (n ≥ 1) provided via standard input.
outputFormat
Output the n-th term of the modified Fibonacci sequence on a single line to standard output.
## sample1
0
</p>