Problem list
Log in
#r03240 · Online Judge > GoldOJ

Nth Padovan Number

Silver III 2.0 s 256 MB

The Padovan sequence is $1, 1, 1, 2, 2, 3, 4, 5, 7, 9, \dots$ where $P(n) = P(n-2) + P(n-3)$ and $P(1) = P(2) = P(3) = 1$. Given $N$, print the $N$-th term.

Input

One integer $N$ ($1 \le N \le 60$).

Output

Print the $N$-th Padovan number.

Example 1

Input
10
Output
9
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code