#K33062. Modified Fibonacci Sequence

    ID: 25004 Type: Default 1000ms 256MiB

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.

## sample
1
0

</p>