Fibonacci-like Sequence

Given n up to 116, compute the n-th term of the recurrence f(n) = f(n-1) + f(n-3) with f(1)=f(2)=f(3)=1.

Easy2Dynamic programmingMathImplementationNo attempts yetTime limit2sMemory limit512 MB

Problem

The Fibonacci-like sequence is defined by f(n)=f(n1)+f(n3)f(n) = f(n-1) + f(n-3), with f(1)=f(2)=f(3)=1f(1) = f(2) = f(3) = 1. Its first terms are:

1, 1, 1, 2, 3, 4, 6, 9, 13, 19, ...

Given a positive integer nn, find the nn-th term of the Fibonacci-like sequence.

Input

The first line contains a positive integer nn (1n1161 \le n \le 116).

Output

Print the nn-th term of the Fibonacci-like sequence.