Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/rekursiya-fibonachchi-soni

Fibonacci number

Easy 1000 ms 64 MB 27%
Share

You are given an integer $n$. Using recursion, find the $n$-th Fibonacci number.

The Fibonacci sequence is defined as follows:
$$F_0 = 0$$
$$F_1 = 1$$
$$F_n = F_{n-1} + F_{n-2} \quad (n \ge 2)$$

The recursion tree: every Fibonacci number calls the previous two

Input

One line with an integer $n$ ($0 \le n \le 30$).

Output

The value of $F_n$.

Note

$0 \le n \le 30$

Examples

Input #1
0
Output #1
0
Input #2
6
Output #2
8

Sign in to submit a solution

Signing up is free and takes a minute.